7.108 Bug in maximize with trig functions in Maple V.3 to Maple V.5 (6.2.97)

7.108.1 Jay Bourland

There seems to be a bug in minimize/maximize for the trig functions:

> maximize(sin(x),x,0..1); 
 
                                  1 
 
> evalf(sin(1)); 
 
                             .8414709848 
 
> minimize(sin(x),x,-1..0); 
                               -sin(1)
 

It is corrected with Maple 6. (U. Klein)

7.108.2 David L. Johnson

MO, the maximize() function from release 3 (which I guess might be what you are using here) is not very good.

Here is another example:

> maximize(sin(x)+cos(x),x,0..0.2); 
 
                                       1/2 
                                      2
 

I don’t, however, consider that to be too much of a problem, since you can do all the steps to really find the maximum easily and reliably.

I try not to let students know about the maximize() function, since I want them to understand the process. That and its unreliable performance, that is.

7.108.3 Robert Israel

Don’t use "maximize" and "minimize"! They are unreliable at best and misleading at worst.

It’s not so much the bugs as the unrealistic expectations. "minimize" and "maximize" work in basically the same way as a calculus student would: look at the function at its critical points, singular points and endpoints, and take the minimum or maximum value. But critical points can only be found by solving the equation \(f'(x)=0\). Unfortunately, except for rational functions "solve" can’t be relied on to find all the solutions: the most it will usually do is to find one. The result is that "maximize" and "minimize" will give wrong answers if the actual max or min is at a different critical point.

I realize that the bug in this case is a bit different: Maple knows that \(\sin (x)\) has a critical point at x=Pi/2, but maybe somehow it doesn’t realize that Pi/2 is not in the interval 0 to 1.