Partial Derivatives and Their Graphs
First we define an expression that represents the value of f(x,y).
> f:=x^2+4*x^2*y-3*y^2;
We can plot the graph z = f(x,y) using plot3d.
> plot3d(f,x=-2..2,y=-2..2,axes=boxed);
The partial derivative of f with respect to x can be found using diff.
> fx:=diff(f,x);
Two or more graphs can be displayed on one set of axes by drawing the graphs separately and saving them.
Let a be the graph of fx. Note that we use a colon (rather than a semicolon) to avoid printing data we would
just as soon not see.
> a:=plot3d(fx,x=-2..2,y=-2..2):
Let xy be the graph of the xy plane, z = 0.
> xy:=plot3d(0,x=-2..2,y=-2..2):
To display the two graphs together, we use the command, display , which is in the plots library
> with(plots);
> display(a,xy,axes=boxed);
We can do the same with the partial of f with respect to y.
> fy:=diff(f,y);
> b:=plot3d(fy,x=-2..2,y=-2..2):
> display(b,xy,axes=boxed);
Likewise, we can look at the second partials.
> fxx := diff(f,x,x);
> c:=plot3d(fxx,x=-2..2,y=-2..2):
> display(c,xy,axes=boxed);
> fxy := diff(f,x,y);
> d:=plot3d(fxy,x=-2..2,y=-2..2):
> display(d,xy,axes=boxed);
> fyy := diff(f,y,y);
>