var('x,y')f=x^2+y^2myplot=contour_plot(f,(-3,3),(-3,3),fill=False,cmap='prism',contours=[0.5*tfortinrange(-8,8)])gradient_field=plot_vector_field([f.diff(x),f.diff(y)],(x,-3,3),(y,-3,3))show(myplot+gradient_field,figsize=(4,4))html('<h2> Contour plot and gradient field of $f(x,y) = %s$ </h2>'%latex(f))
Contour plot and gradient field of f(x,y) = {y}^{2} + {x}^{2}
var('x,y')f=x*ymyplot=contour_plot(f,(-3,3),(-3,3),fill=False,cmap='prism',contours=[0.5*tfortinrange(-8,8)])gradient_field=plot_vector_field([f.diff(x),f.diff(y)],(x,-3,3),(y,-3,3))show(myplot+gradient_field,figsize=(5,5))html('<h2> Contour plot and gradient field of $f(x,y) = %s$ </h2>'%latex(f))
Contour plot and gradient field of f(x,y) = {x y}
var('x,y')f=x^2-x*y+y^2myplot=contour_plot(f,(-3,3),(-3,3),fill=False,cmap='prism',contours=[tfortinrange(0,8)])gradient_field=plot_vector_field([f.diff(x),f.diff(y)],(x,-3,3),(y,-3,3))show(myplot+gradient_field,figsize=(5,5))html('<h2> Contour plot and gradient field of $f(x,y) = %s$ </h2>'%latex(f))
Contour plot and gradient field of f(x,y) = {y}^{2} - {x y} + {x}^{2}