# Singular

### 5.1.22 diff

`Syntax:`
`diff (` poly_expression`,` ring_variable `)`
`diff (` vector_expression`,` ring_variable `)`
`diff (` ideal_expression`,` ring_variable `)`
`diff (` module_expression`,` ring_variable `)`
`diff (` matrix_expression`,` ring_variable `)`
`Type:`
the same as the type of the first argument
`Syntax:`
`diff (` ideal_expression`,` ideal_expression `)`
`Type:`
matrix
`Syntax:`
`diff (` number_expression`,` ring_parameter `)`
`Type:`
number
`Purpose:`
computes the partial derivative of a polynomial object by a ring variable (first forms)
respectively differentiates each polynomial (1..n) of the second ideal by the differential operator corresponding to each polynomial (1..m) in the first ideal, producing an m x n matrix.
respectively if the coefficient ring is a transcendental field extension, differentiates a number (that is, a rational function) by a transcendental variable (ring parameter).
`Example:`
 ``` ring r=0,(x,y,z),dp; poly f=2x3y+3z5; diff(f,x); ==> 6x2y vector v=[f,y2+z]; diff(v,z); ==> 15z4*gen(1)+gen(2) ideal j=x2-yz,xyz; ideal i=x2,x2+yz,xyz; // corresponds to differential operators // d2/dx2, d2/dx2+d2/dydz, d3/dxdydz: print(diff(i,j)); ==> 2,0, ==> 1,x, ==> 0,1 // differentiation of rational functions: ring R=(0,t),(x),dp; number f = t^2/(1-t)^2; diff(f,t); ==> (-2t)/(t3-3t2+3t-1) ```
See contract; ideal; jacob; matrix; module; poly; var; vector.