222 - Topic 03 - 3D Limits

2277 days ago by Professor222

Multivariate Limits

John Travis

Mississippi College

Exhibiting graphically whether a given surface has a limit.

In this worksheet, the user can demonstrate interactively and graphically limit for surfaces of the form z = f(x,y) using a "polar coordinates" approach.

The user can manipulate a slider and see visually what happens as the radius of domain values collapses around the given domain point.  If the region collapses to a point, then the user can suspect that a limit indeed exists at the given point.

Several example functions to examine for limits are posted at the bottom of this worksheet.  One might cut-and-paste these functions into the interactive cells or simply type in something else.

(Programming feature to add:  Clip the 3D graph off vertically if there happen to be asymptotes somewhere.  Otherwise, the graph is squashed.  However, in this case the contour plot can be utilized.)

## An interactive way to demonstrate limits of multivariate functions of the form z = f(x,y) ## ## John Travis ## Mississippi College ## ## Spring 2011 ## # Starting point for radius values before collapsing in as R approaches 0. # Functions ought to be "reasonable" within a circular domain of radius R surrounding # the desired (x_0,y_0). var('x,y,z') Rmin=1/10 Rmax=2 @interact(layout=dict(top=[['f'],['x0','y0']], bottom=[['in_3d','curves','R','graphjmol']])) def _(f=input_box((7*x^4 - y^4)/(x^4 + 5*y^4),width=30,label='$f(x)$'), R=slider(Rmin,Rmax,1/10,Rmax,label=',   $R$'), x0=input_box(0,width=10,label='$x_0$'), y0=input_box(0,width=10,label='$y_0$'), curves=checkbox(default=false,label='Show curves'), in_3d=checkbox(default=false,label='3D'), graphjmol=checkbox(default=true,label='Interactive graph')): if graphjmol: view_method = 'jmol' else: view_method = 'tachyon' # converting f to cylindrical coordinates. g(r,t) = f(x=r*cos(t)+x0,y=r*sin(t)+y0) # Sage graphing transformation used to see the original surface. cylinder = (r*cos(t)+x0,r*sin(t)+y0,z) surface = plot3d(g,(t,0,2*pi),(r,1/100,Rmax),transformation=cylinder,opacity=0.2) # Regraph the surface for smaller and smaller radii controlled by the slider. collapsing_surface = plot3d(g,(t,0,2*pi),(r,1/100,R),transformation=cylinder,rgbcolor=(0,1,0)) G = surface+collapsing_surface pretty_print(html('Enter $(x_0 ,y_0 )$ above and see what happens as $ R \\rightarrow 0 $.')) pretty_print(html('The surface has a limit as $(x,y) \\rightarrow $ ('+str(x0)+','+str(y0)+') if the green region collapses to a point.')) # If checked, add a couple of curves on the surface corresponding to limit as x->x0 for y=x^(3/5), # and as y->y0 for x=y^(3/5). Should make this more robust but perhaps using # these relatively obtuse curves could eliminate problems. if curves: curve_x = parametric_plot3d([x0-t,y0-t^(3/5),f(x=x0-t,y=y0-t^(3/5))],(t,Rmin,Rmax),color='red',thickness=10) curve_y = parametric_plot3d([x0+t^(3/5),y0+t,f(x=x0+t^(3/5),y=y0+t)],(t,Rmin,Rmax),color='red',thickness=10) R2 = Rmin/4 G += arrow((x0-Rmin,y0-Rmin^(3/5),f(x=x0-Rmin,y=y0-Rmin^(3/5))),(x0-R2,y0-R2^(3/5),f(x=x0-R2,y=y0-R2^(3/5))),size=30 ) G += arrow((x0+Rmin^(3/5),y0+Rmin,f(x=x0+Rmin^(3/5),y=y0+Rmin)),(x0+R2^(3/5),y0+R2,f(x=x0+R2^(3/5),y=y0+R2)),size=30 ) limit_x = limit(f(x=x0-t,y=y0-t^(3/5)),t=0) limit_y = limit(f(x=x0+t^(3/5),y=y0+t),t=0) text_x = text3d(limit_x,(x0,y0,limit_x)) text_y = text3d(limit_y,(x0,y0,limit_y)) G += curve_x+curve_y+text_x+text_y pretty_print('The red curves represent a couple of trajectories on the surface. If they do not meet, then') pretty_print('there is also no limit. (If computer hangs up, likely the computer can not do these limits.)') pretty_print('\n<center><font color="red">$\lim_{(x,?)\\rightarrow(x_0,y_0)} f(x,y) =%s$</font>'%str(limit_x)+' and <font color="red">$\lim_{(?,y)\\rightarrow(x_0,y_0)} f(x,y) =%s$</font></center>'%str(limit_y)) pretty_print(html(' $z = %s$'%str(latex(f)))) if in_3d: show(G,stereo="redcyan",viewer=view_method) else: show(G,perspective_depth=true,viewer=view_method) 
       
$f(x)$ 
$x_0$  $y_0$ 
3D  Show curves  ,   $R$ 
Interactive graph 

Click to the left again to hide and once more to show the dynamic interactive window

Another interactive look at multivariate limits but using contour plots.

## An interactive way to demonstrate limits of multivariate functions of the form z = f(x,y) ## This one uses contour plots and so will work with functions that have asymptotic behavior. ## ## John Travis ## Mississippi College ## ## Spring 2011 ## # An increasing number of contours for z = f(x,y) are utilized surrounding a desired (x_0,y_0). # A limit can be shown to exist at (x_0,y_0) provided the point stays trapped between adjacent # contour lines as the number of lines increases. If the contours change wildly near the point, # then a limit does not exist. # Looking for two different paths to approach (x_0,y_0) that utilize a different selection of colors # will help locate paths to use that exhibit the absence of a limit. var('x,y,z,u') @interact(layout=dict(top=[['f'],['x0'],['y0']], bottom=[['N'],['R']])) def _(f=input_box(default=(x*y^2)/(x^2+y^4),width=30,label='$f(x)$'), N=slider(5,100,1,10,label='Number of Contours'), R=slider(0.1,1,0.01,1,label='Radius of circular neighborhood'), x0=input_box(0,width=10,label='$x_0$'), y0=input_box(0,width=10,label='$y_0$')): pretty_print(html('Enter $(x_0 ,y_0 )$ above and see what happens as the number of contour levels $\\rightarrow \infty $.')) pretty_print(html('A surface will have a limit in the center of this graph provided there is not a sudden change in color there.') ) # Need to make certain the min and max contour lines are not huge due to asymptotes. If so, clip and start contours at some reasonable # values so that there are a nice collection of contours to show around the desired point. surface = contour_plot(f,(x,x0-1,x0+1),(y,y0-1,y0+1),cmap=True,colorbar=True,fill=False,contours=N) surface += parametric_plot([R*cos(u),R*sin(u)],[0,2*pi],color='black') # Nice to use if f=x*y^2/(x^2 + y^4) # var('u') # surface += parametric_plot([u^2,u],[u,-1,1],color='black') limit_point = point((x0,y0),color='red',size=30) show(limit_point+surface) # surface.show() 
       

Click to the left again to hide and once more to show the dynamic interactive window

# here are a few example functions to utilize var('x,y,z') f=(x^3-y^3)/(x^2+y^2) # has a limit at (0,0) #f=(x^2-y^2)/(x^2+y^2) # doesn't have a limit at (0,0) # f=((x-1)^2-(y+2)^2)/((x-1)^2+(y+2)^2) # doesn't have a limit at (1,-2) 
       
%auto ## An interactive way to demonstrate limits of multivariate functions of the form z = f(x,y) ## ## John Travis ## Mississippi College ## ## Spring 2011 ## # Starting point for radius values before collapsing in as R approaches 0. # Functions ought to be "reasonable" within a circular domain of radius R surrounding # the desired (x_0,y_0). var('x,y,z') Rmin=1/10 Rmax=2 f1 = sin(x^2+y^2-1)/(1-x^2-y^2) f2 = sin(x*y) f3 = ln(abs(x-y)) f4 = (x^3-y^3)/(x^2+y^2) f5 = x^3*y/(x^6+y^2) f6 = x^2*y^2/(5*x^4+y^4) @interact(layout=dict(top=[['f'],['x0'],['y0']], bottom=[['in_3d','curves','R']])) def _(f=selector([f1,f2,f3,f4,f5,f6],buttons=False,label='f(x,y)='), R=slider(Rmin,Rmax,1/10,Rmax,label=',   $R$'), x0=input_box(0,width=10,label='$x_0$'), y0=input_box(0,width=10,label='$y_0$'), curves=checkbox(default=false,label='Show curves'), in_3d=checkbox(default=false,label='3D')): # converting f to cylindrical coordinates. g(r,t) = f(x=r*cos(t)+x0,y=r*sin(t)+y0) # Sage graphing transformation used to see the original surface. cylinder = (r*cos(t)+x0,r*sin(t)+y0,z) surface = plot3d(g,(t,0,2*pi),(r,1/100,Rmax),transformation=cylinder,opacity=0.2) # Regraph the surface for smaller and smaller radii controlled by the slider. collapsing_surface = plot3d(g,(t,0,2*pi),(r,1/100,R),transformation=cylinder,rgbcolor=(0,1,0)) G = surface+collapsing_surface pretty_print(html('Enter $(x_0 ,y_0 )$ above and see what happens as $ R \\rightarrow 0 $.')) pretty_print(html('The surface has a limit as $(x,y) \\rightarrow $ ('+str(x0)+','+str(y0)+') if the green region collapses to a point.')) # If checked, add a couple of curves on the surface corresponding to limit as x->x0 for y=x^(3/5), # and as y->y0 for x=y^(3/5). Should make this more robust but perhaps using # these relatively obtuse curves could eliminate problems. H = contour_plot(f,(x,x0-1,x0+1),(y,y0-1,y0+1),cmap=True,fill=False,contours=100) if curves: curve_x = parametric_plot3d([x0-t,y0-t^(3/5),f(x=x0-t,y=y0-t^(3/5))],(t,Rmin,Rmax),color='red',thickness=10) curve_y = parametric_plot3d([x0+t^(3/5),y0+t,f(x=x0+t^(3/5),y=y0+t)],(t,Rmin,Rmax),color='red',thickness=10) curve_xnoz = parametric_plot([x0-t,y0-t^(3/5)],(t,0.01,Rmax/2),color='black',thickness=2) curve_ynoz = parametric_plot([x0+t^(3/5),y0+t],(t,0.01,Rmax/2),color='black',thickness=2) R2 = Rmin/4 G += arrow((x0-Rmin,y0-Rmin^(3/5),f(x=x0-Rmin,y=y0-Rmin^(3/5))),(x0-R2,y0-R2^(3/5),f(x=x0-R2,y=y0-R2^(3/5))),size=30 ) G += arrow((x0+Rmin^(3/5),y0+Rmin,f(x=x0+Rmin^(3/5),y=y0+Rmin)),(x0+R2^(3/5),y0+R2,f(x=x0+R2^(3/5),y=y0+R2)),size=30 ) limit_x = limit(f(x=x0-t,y=y0-t^(3/5)),t=0) limit_y = limit(f(x=x0+t^(3/5),y=y0+t),t=0) text_x = text3d(limit_x,(x0,y0,limit_x)) text_y = text3d(limit_y,(x0,y0,limit_y)) G += curve_x+curve_y+text_x+text_y H += curve_xnoz+curve_ynoz pretty_print(html('The red curves represent a couple of trajectories on the surface. If they do not meet, then')) pretty_print(html('there is also no limit. (If computer hangs up, likely the computer can not do these limits.)')) pretty_print(html('\n<center><font color="red">$\lim_{(x,?)\\rightarrow(x_0,y_0)} f(x,y) =%s$</font>'%str(limit_x)+' and <font color="red">$\lim_{(?,y)\\rightarrow(x_0,y_0)} f(x,y) =%s$</font></center>'%str(limit_y))) pretty_print(html('\n For this problem, the surface is $z = %s$'%str(latex(f)))) if in_3d: show(G,stereo="redcyan") else: show(G,perspective_depth=true) H.show(figsize=(4,6)) 
       
f(x,y)= 
$x_0$ 
$y_0$ 
3D  Show curves  ,   $R$ 

Click to the left again to hide and once more to show the dynamic interactive window