>
Warning, the name changecoords has been redefined
>
Maple Examples for Maximum Minimum Problems in Two Variables
Here are some sample commands related to finding maximum and minimum
values of a function f(x,y). In particular, Maple can find the partial derivatives,
solve for the critical points, etc. Notice too how useful it is to plot functions near
the critical points.
> f := x^3+y^3+3*x^2-3*y^2-8;
3 3 2 2
f := x + y + 3 x - 3 y - 8
Let's solve for the critical points. Note how the Maple commands
groups both the equations to be solved and the variables to be solved for.
> solve( {diff(f,x)=0, diff(f,y)=0},{x,y} );
{x = 0, y = 0}, {x = 0, y = 2}, {y = 0, x = -2}, {y = 2, x = -2}
OK, those are the critical points. Which correspond to local maximum and minimum
values? One approach is to look at the graphs ...
> with(plots): contourplot(f,x=-2.5 .. 2.5, y=-2.5 .. 2.5);
> plot3d(f,x=-2.5 .. 2.5, y=-2.5 .. 2.5);
The graphs are interesting, but they don't show everything. Try zooming in a little
more closely to see what's happening at each of the four critical points.
For example, try the commands below to look more closely at the
critical point at (0,2). (The pictures will show that it's a local minimum.)
> contourplot(f,x=-0.5 .. 0.5, y=1.5 .. 2.5);
> plot3d(f,x=-0.5 .. 0.5, y=1.5 .. 2.5);
Try the same thing around some of the other critical points ...
Here's a Maple approach to Problem 11, page 218. Note that you can
easily vary the inputs to solve Problem 12, page 218, too.
> v := x*y*(12-x*y)/(2*x+2*y);
> diff(v,x);
> v1 :=simplify(%);
> diff(v,y);
> v2 := simplify(%);
OK, now let's find our critical points. We could do this by hand, but Maple
makes it quite easy.
> solve({v1=0,v2=0},{x,y});
In the present context, only the first critical point is of interest, because negative
values for the sides of a box don't make any sense.
So let's try to figure out the matrix of second partial derivatives:
> diff(v,x,x);
> v11 := simplify(%);
> v12 := simplify( diff(v,x,y));
> v21 := simplify(diff(v,y,x));
> v22 := simplify( diff(v,y,y) );
> subs(x=2,y=2,v11), subs(x=2,y=2,v12), subs(x=2,y=2,v22);
> with( linalg ):
This command loads some commands, including one to calculate the Hessian matrix of a function.
> hessian(v,[x,y]);
> subs(x=2,y=2,%);
> plot3d( v,x=1..3, y=1..3);
The plot shows, as it should, that the point (2,2) is a local (and actually global) maximum
for the function v.
Try varying any of the data in this example to solve other, similar problems.