1.11 DerivativesΒΆ
Use the FriCAS function D to differentiate an expression.
To find the derivative of an expression f with respect to a variable x,
enter D(f, x)
.
f := exp exp x
Type: Expression Integer
D(f, x)
Type: Expression Integer
An optional third argument n in D asks FriCAS for the n-th derivative of f. This finds the fourth derivative of f with respect to x.
D(f, x, 4)
Type: Expression Integer
You can also compute partial derivatives by specifying the order of differentiation.
g := sin(x^2 + y)
Type: Expression Integer
D(g, y)
Type: Expression Integer
D(g, [y, y, x, x])
Type: Expression Integer
FriCAS can manipulate the derivatives (partial and iterated) of expressions involving formal operators. All the dependencies must be explicit.
This returns 0 since F (so far) does not explicitly depend on x.
D(F,x)
Type: Polynomial Integer
Suppose that we have F a function of x, y, and z, where x and y are themselves functions of z.
Start by declaring that F, x, and y are operators. operator
F := operator 'F; x := operator 'x; y := operator 'y
Type: BasicOperator
You can use F, x, and y in expressions.
a := F(x z, y z, z^2) + x y(z+1)
Type: Expression Integer
Differentiate formally with respect to z. The formal derivatives appearing in dadz are not just formal symbols, but do represent the derivatives of x, y, and F.
dadz := D(a, z)
Type: Expression Integer
You can evaluate the above for particular functional values of F, x, and y. If x(z) is exp(z) and y(z) is log(z+1), then evaluates dadz.
eval(eval(dadz, 'x, z +-> exp z), 'y, z +-> log(z+1))
Type: Expression Integer
You obtain the same result by first evaluating a and then differentiating.
eval(eval(a, 'x, z +-> exp z), 'y, z +-> log(z+1))
Type: Expression Integer
D(%, z)
Type: Expression Integer