List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Maximize/minimize
| [MUG] Maximize/minimize |
|
Author: Jim Gunson
Posted: Tue, 30 Apr 2002 10:58:45 -0700
|
>> From: "Jim Gunson" "Jim.Gunson"
Maple's maximize fails on the function below:
>f:=x->abs(sin(x)*exp(x));
>maximize(f(x),x=0..5);
Error, (in maximize) wrong number (or type) of parameters in function map
I can work around it, as follows, but I think that maximize should work
in such cases. The application was to find the max of the absolute value
of the second derivative, which is used to determine the max error in
approximating an integral using the trapeziodal rule.
> maxabs:=proc(expr,range);
> return(max(maximize(expr,range),minimize(-expr,range)));
> end;
Cheers
Jim Gunson
Instructor in Mathematics
Kwantlen University College
12666 72 Ave
Surrey, B.C.
Canada
V3W 2M8
|
| [MUG] Re: Maximize/minimize |
|
Author: Carl Devore
Posted: Fri, 3 May 2002 02:04:46 -0400 (
|
>> From: Carl Devore "devore"
| >> From: "Jim Gunson" "Jim.Gunson"
|
| Maple's maximize fails on the function below:
|
| >f:=x->abs(sin(x)*exp(x));
| >maximize(f(x),x=0..5);
|
| Error, (in maximize) wrong number (or type) of parameters in function map
|
| I can work around it, as follows, but I think that maximize should work
| in such cases.
In this case, it will also work if you assume that x is real.
> assume(x, real);
Clearly, the "x= 0..5" should imply that x is real, but Maple does not see
it that way.
| The application was to find the max of the absolute value
| of the second derivative, which is used to determine the max error in
| approximating an integral using the trapeziodal rule.
|
| > maxabs:=proc(expr,range);
| > return(max(maximize(expr,range),minimize(-expr,range)));
| > end;
I have done exactly the same thing, for the same reason, and I came up
woth the same workaround. Ultimately, though, I gave up on the maximize
and minimize commands for this application. Use numapprox[infnorm]
instead.
> numapprox[infnorm](exp(x)*sin(x), x= 0..5);
142.3169809
|
Previous by date: [MUG] FW: Position at WMI, L Bernardin
Next by date: [MUG] a bug or a feature?, Rouben Rostamian
Previous thread: [MUG] Creating new names, Bob McElrath
Next thread: [MUG] a bug or a feature?, Rouben Rostamian
|