| Here is an example where the order in which we take the partial derivatives makes a big difference. Consider the following function of two variables: |
> f := proc(x,y)
> if x = 0 and y = 0 then RETURN( 0 )
> else RETURN( x*y*(x^2-y^2)/(x^2+y^2) )
> fi;
> end;
f := proc(x, y)
if x = 0 and y = 0 then RETURN(0)
else RETURN(x*y*(x^2 - y^2)/(x^2 + y^2))
fi
end
> assume(a>0, b >0): 2 2
a~ b~ (a~ - b~ )
-----------------
2 2
a~ + b~
> fx := unapply(diff(f(x,y),x),x,y);
2 2 2 2 2 2
y (x - y ) x y x y (x - y )
fx := (x, y) -> ----------- + 2 ------- - 2 --------------
2 2 2 2 2 2 2
x + y x + y (x + y )
> fx(0,y);
-y
| That is the partial derivative of f w.r.t. x evaluated at (0,y) is -y for all values of y. Thus, fyx(0,0) = -1. On the other hand, |
> fy := unapply(diff(f(x,y),y),x,y);
2 2 2 2 2 2
x (x - y ) x y x y (x - y )
fy := (x, y) -> ----------- - 2 ------- - 2 --------------
2 2 2 2 2 2 2
x + y x + y (x + y )
> fy(x,0);
x
| So the partial derivative of f w.r.t. y at (x,0) is x for all values of x. Hence, fxy(0,0) = 1. The two mixed partial derivatives are different at the point (0,0). |