Gradient Field Plots with Contours
Dr. K. G. TeBeest

> with( plots ) :

Warning, the name changecoords has been redefined

Example 1:   Elliptic Paraboloid

> f := x^2 + 2*y^2 ;

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 } );

[Maple Plot]

Example 2:   Hypberbolic Paraboloid

> f := x^2 – y^2 ;

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 } );

[Maple Plot]

NOTES: Recall that function z = f ( x, y) can be interpreted as a surface in 3-D.

  1. The gradient vector of f at point (a,b) is orthogonal to the contour of f through (a,b).
  2. The gradient vector of f at point (a,b) points in the direction in which function f increases most rapidly.
    So at point (a,b), f is steepest in the direction of the gradient vector.
  3. The length of the gradient vector of f at point (a,b) gives the rate of change of f 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).
  4. If we view function f as a surface in 3-D, then water would flow along a path parallel to the gradient vectors, but in the opposite direction of the gradient vectors. The water's path would also be perpendicular (orthogonal) to the contours.


Return to Section 14.6

Dr. K. G. TeBeest
Applied Mathematics
Kettering University