CoCalc Public Filesunits2021 / analytical_methods / lectures / graphical interpretation of partial derivaties.sagewsOpen with one click!
Author: Killian O'Brien
Views : 26
License: GNU General Public License v3.0
Compute Environment: Ubuntu 18.04 (Stable)

Graphical interpretation of partial derivatives of a function of two variables

The interactive demo below shows the surface defined by the function z=f(x,y)=sin(xy)z=f(x,y)=\sin(xy) together with the cross-sectional curves through the surface parallel to the xx and yy axes and based at the base point (x,y)=(a,b)(x,y)=(a,b). Use the slider controls to set the values of aa and bb and observe the form of the cross-sectional curves and values of the partial derivatives.

f(x,y)=sin(x*y) xlim = 5*pi/4 # limit for the x coordinate ylim = 5*pi/4 # limit for the y coordinate @interact def demo(a = slider(-xlim,xlim,2*xlim/100,0), b = slider(-ylim,ylim,2*ylim/100,0)): p=plot3d(f(x,y), (x, -xlim, xlim), (y, -ylim, ylim), opacity=0.8) xslice=parametric_plot3d([x,b,f(x,b)],(x,-xlim,xlim),color='red', thickness=8) yslice=parametric_plot3d([a,y,f(a,y)],(y,-ylim,ylim),color='green', thickness=8) pnt=point((a,b,f(a,b)), color='black',size=10) show('The surface defined by $z = f(x,y)$ with cross-sectional curves, from the base point $(a,b)=('+str(n(a,digits=3))+','+str(n(b,digits=3))+')$'+ ' in the $x$ and $y$ directions.') show(p+xslice+yslice+pnt, spin=2.5) fx=f.diff(x) fy=f.diff(y) p=plot(f(x,b),(x,-xlim,xlim),color='red', thickness=6, axes_labels=['$x$','$z$']) q=plot(f(a,y),(y,-ylim,ylim),color='green', thickness=6, axes_labels=['$y$','$z$']) show('The derivative $f_x(a,b)\\approx'+str(n(fx(a,b),digits=3))+'$.') show(p+point((a,f(a,b)), color='black', size=150,zorder=5)) show('The derivative $f_y(a,b)\\approx'+str(n(fy(a,b),digits=3))+'$.') show(q+point((b,f(a,b)), color='black', size=100,zorder=5))
Interact: please open in CoCalc