>

Exercise 43 (Section 15.8)

> restart;

> with( plots ):

Warning, the name changecoords has been redefined

> setoptions3d( axes=boxed, shading=zhue );

>

> f := cos( abs(x) + y^2 ) + 10*x*exp(-x^2-y^2);

f := cos(abs(x)+y^2)+10*x*exp(-x^2-y^2)

> plot3d( f, x=-2..2, y=-2..2, orientation=[-120,85] );

[Maple Plot]

From the plot it is obvious that there are two critical points in this square. Moreover, the function values on the boundary are global extrema. Thus, the global max and min occur at the two critical points. All that remains is to determine the location of these critical points.

>

A first step is to look at the contour plot.

> plot3d( f, x=-2..2, y=-2..2, style=contour, orientation=[-90,0] );

[Maple Plot]

>

The gradient of f consists of the two components:

> fx := diff( f, x );

> fy := diff( f, y );

fx := -sin(abs(x)+y^2)*abs(1,x)+10*exp(-x^2-y^2)-20...

fy := -2*sin(abs(x)+y^2)*y-20*x*y*exp(-x^2-y^2)

>

The critical points are

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

{y = RootOf(1+_Z^2-RootOf(-_Z+ln(-10*1/sin(_Z))),-1...
{y = RootOf(1+_Z^2-RootOf(-_Z+ln(-10*1/sin(_Z))),-1...

>

Well, I suppose it was too much to expect Maple (or anyone) to find analytic expressions for the critical points. Let's turn to numerical approximations. The global minimum occurs at the critical point with x<0 (and y near 0):

> fsolve( {fx=0,fy=0}, {x,y}, {x=-1..0,y=-1..1} );

{y = 0., x = -.7480034062}

>

The global maximum occurs at the critical point with x>0 (and y near 0):

> fsolve( {fx=0,fy=0}, {x,y}, {x=0..1,y=-1..1} );

{x = .6716741826, y = 0.}

>