gradient

1477 days ago by Marnix.VanDaele

 
       
x, y=var('x y') f(x,y)=sqrt(1-x^2-y^2) plot3d(f(x,y),(x,-1,1),(y,-1,1)) 
       
contour_plot(f(x,y), (x,-1,1), (y,-1,1), contours=(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9)) 
       
contour_plot(f(x,y), (x,-1,1), (y,-1,1), contours=(0,sqrt(3)/2)) 
       
gradient=f.gradient() gradient(x,y) 
       
(-x/sqrt(-x^2 - y^2 + 1), -y/sqrt(-x^2 - y^2 + 1))
(-x/sqrt(-x^2 - y^2 + 1), -y/sqrt(-x^2 - y^2 + 1))
[diff(f(x,y),x),diff(f(x,y),y)] 
       
[-x/sqrt(-x^2 - y^2 + 1), -y/sqrt(-x^2 - y^2 + 1)]
[-x/sqrt(-x^2 - y^2 + 1), -y/sqrt(-x^2 - y^2 + 1)]
# de twee onderstaande commando's produceren net hetzelfde p1=plot_vector_field([diff(f(x,y),x),diff(f(x,y),y)], (x,-1,1), (y,-1,1)) # p2=plot_vector_field(gradient(x,y), (x,-1,1), (y,-1,1)) show(p1) 
       
pretty_print(gradient(0.5,0)) pretty_print(gradient(-0.5,0)) pretty_print(gradient(0,0.5)) pretty_print(gradient(0,-0.5))