Example: One variable.
y:= (x-1)*(1-x)*(x-2);
extrema(y,{},{x},'cp'); # Compute extreme value of y
evalf(%); # Answer in decimal form
cp; # Variable cp contains the critical points of y
evalf(cp); # Print in decimal form
Example: Two variables
unassign('x','y'): z:= (1-x)*(2-y)*(1-y)^2;
extrema(z,{},{x,y},'cp');
evalf(%); # Print in decimal form
cp; # Print the critical points of z
evalf(cp); # Print in decimal form
Maximize and Minimize Functions
These Maple functions find the minima and maxima and omit any other
possible critical points. The functions have existed as part of the
Maple kernel since Ver 7 of Maple. Examples:
minimize(cos(x),x=1..3); # Answer cos(3)
maximize(cos(x),x=1..3); # Answer cos(1)
minimize(x^2-3*x+y^2+3*y+3, location);
# Answer -3/2, {[{x = 3/2, y = -3/2}, -3/2]}