Gradient Field Plots with Contours
Dr. K. G. TeBeest
> with( plots ) :
Warning, the name changecoords has been redefined> f := x^2 + 2*y^2 ;
> gp := gradplot( f, x = 8.0 .. 8.0, y = 8.0 .. 8.0, grid = [11,11], color = f, arrows = THICK, scaling = constrained ) :
> cp := contourplot( f , x = 8.0 .. 8.0, y = 8.0 .. 8.0, thickness = 3, scaling = constrained, color = black ) :
> display( { gp, cp } );
Example 2: Hypberbolic Paraboloid
> f := x^2 y^2 ;
> gp := gradplot( f, x = 4.0 .. 4.0, y = 4.0 .. 4.0, grid = [11,11], color = f, arrows = thick, scaling = constrained ) :
> cp := contourplot( f , x = 4.0 .. 4.0, y = 4.0 .. 4.0, thickness = 3, scaling = constrained, color = black ) :
> display( { gp, cp } );
NOTES:
Recall that function z = f ( x, y) can be interpreted as
a surface in 3-D.
So at point (a,b), f is steepest in the direction
of the gradient vector.
So f is steeper where the gradient vectors are longer
(and where the contours are closely packed);
f is less steep where the gradient vector is shorter
(and where the contours are further apart).
Dr. K. G. TeBeest
Applied Mathematics
Kettering University