Example 1: Unconstrained Optimization (Exercise 36)

> f := y/(1+x^2+y^2);

f := y/(1+x^2+y^2)

>

Three plots of this function appear on p. 636 of the text. Here are the Maple equivalents (see also the worksheet for Section 15.1).

> plot3d( f, x=-5..5, y=-5..5, orientation=[-45,45], title="Figure 16 a" );

[Maple Plot]

> plot3d( f, x=-5..5, y=-5..5, style=patchcontour, orientation=[-45,45], title="Figure 16 b" );

[Maple Plot]

> plot3d( f, x=-5..5, y=-5..5, style=contour, orientation=[-90,0],
title="Figure 16 c" );

[Maple Plot]

>

From these pictures it is clear that there is a unique global maximum and minimum for this function. The critical points appear to have y=0 and the maximum occurs with x>0 while the minimum occurs with x<0.

>

New, let's try to locate these point via calculus.

>

> fx := diff( f, x );

fx := -2*y/(1+x^2+y^2)^2*x

> fy := diff( f, y );

fy := 1/(1+x^2+y^2)-2*y^2/(1+x^2+y^2)^2

> fy := simplify( fy );

fy := (1+x^2-y^2)/(1+x^2+y^2)^2

>

> solve( {fx=0, fy=0}, {x,y} );

{y = 1, x = 0}, {y = -1, x = 0}

>

Thus, Maple finds two critical points. To classify these points as local extrema, use the Second Derivative Test:

>

> fxx := diff( f, x,x );

fxx := 8*y/(1+x^2+y^2)^3*x^2-2*y/(1+x^2+y^2)^2

> fyy := diff( f, y,y );

fyy := -6*y/(1+x^2+y^2)^2+8*y^3/(1+x^2+y^2)^3

> fxy := diff( f, x,y );

fxy := -2/(1+x^2+y^2)^2*x+8*y^2/(1+x^2+y^2)^3*x

>

> discr := simplify( fxx*fyy-fxy^2 );

discr := -4*(x^4+2*x^2*y^2+x^2+y^4-3*y^2)/(1+x^2+y^...

>

One critical point is (0,1):

> cp1 := {x=0,y=1};

cp1 := {y = 1, x = 0}

> eval( discr, cp1 );

1/4

> eval( fxx, cp1 );

-1/2

>

With D>0 and fxx<0, this critical point is a local maximum.

>

The second critical point is (0,-1):

> cp2 := {x=0,y=-1};

cp2 := {y = -1, x = 0}

> eval( discr, cp2 );

1/4

> eval( fxx, cp2 );

1/2

>

With D>0 and fxx>0, this critical point is a local maximum.

>