TITLE: Computing Partial Derivatives with Maple # There are several ways to compute partial derivatives of a function of sevaral variables using Maple. First it depends on how the expression for the function is entered to Maple. We can enter the function as an expression in x,y,z etc... like: > f := 3*z^2*cos(x*z)+x^2/(y^2+sin(y)^2*z); 2 2 x f := 3 z cos(x z) + -------------- 2 2 y + sin(y) z # Partial derivatives can now be computed with "diff". The partial derivative of f with respect to x at an arbitrary point (x,y,z) is given by: > Dfx := Diff(f,x) = diff(f,x); Dfx := / 2 \ d | 2 x | 3 x ---- |3 z cos(x z) + --------------| = - 3 z sin(x z) + 2 -------------- dx | 2 2 | 2 2 \ y + sin(y) z/ y + sin(y) z # If there is a need for evaluating the partials at different values of x,y,z then it is often more convenient to "unapply" the previous expression and then use the function to evaluate. The alternative would be to use "subs" for substitutions. > fx := unapply(op(Dfx)[2],x,y,z); 3 x fx := (x,y,z) -> - 3 z sin(x z) + 2 -------------- 2 2 y + sin(y) z > `fx(1,1,0)` = fx(1,1,0); fx(1,1,0) = 2 > `fx(1,1,0)` = subs({x=1,y=1,z=0},op(Dfx)[2]); fx(1,1,0) = 2 # Mixed partials can be computed with the help of the "$" sequence operator, > Diff('f',x,y$2) = diff(f,x,y$2); Diff(f, x, y, y) = 2 2 2 x (2 y + 2 sin(y) z cos(y)) x (2 + 2 cos(y) z - 2 sin(y) z) 4 ---------------------------- - 2 --------------------------------- 2 2 3 2 2 2 (y + sin(y) z) (y + sin(y) z) # The previous expression is the third order partial derivative of f with respect to x,y and y. Maple assumes that the mixed partials are continuous so it doesn't care about the order. Watch out.