Re: Problem finding maximum
- To: mathgroup at smc.vnet.net
- Subject: [mg127596] Re: Problem finding maximum
- From: Dana DeLouis <dana01 at me.com>
- Date: Sun, 5 Aug 2012 15:00:54 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
> The correct answer is at x=0, where Abs[f[0,aa1]]=0.0540933
Hi. To get x=0 at your stated full precision (no decimal point) then maybe...
v=.7481//Rationalize
7481/10000
f[x_,a_] := (a^3-6 x-a^2 (4+x)+a (2+12 x-4 x^2))/(8 a)
Maximize[{Abs[f[x,v]],0<=x<=v},x]
{43274639/800000000, {x->0} }
%//N
{0.0540933,{x->0.}}
Which, as mentioned, is:
NMaximize[{Abs[f[x,v]],0<=x<=v},x]
{0.0540933,{x->0.}}
I thought this was interesting for your problem...
v=.;
Manipulate[Plot[{Abs[f[x,v]],Abs[f[0,v]]},{x,0,v},
PlotRange->{0,1},
GridLines->False],
{v,$MachineEpsilon,3,1/10}
]
At small values of your variable, the max is the right side of the graph, or when x = v.
At around 0.7, the max is at x=0. (close to your value of .7481)
And at around 1.7, the right side (x=v) is the max.
The middle section is not maximized.
If you were doing a lot of calculations, you could reduce this to using IF statements.
(Below, I kept only the 2 reals)
v=.
Solve[Abs[f[0,v]]==Abs[f[v,v]],v][[-2;;]]
{{v->1/5 (6-Sqrt[6])},
{v->1/5 (6+Sqrt[6])}}
%//N
{{v->0.710102},{v->1.6899}}
(* Above values appear to check from the graph *)
Using these 2 values, you would have 2 different x values giving the same max value.
Using 1 of the values, we do get the same values:
{Abs[f[0,v]],Abs[f[v,v]]}/.v->1/5 (6-Sqrt[6]) //N
{0.0420204, 0.0420204}
If we pick a value, and use Maximize, only 1 x value is given.
v=1/5 (6-Sqrt[6]);
Maximize[{Abs[f[x,v]],0<=x<=v},x] //FullSimplify
{1/50 (7-2 Sqrt[6]), {x->1/5 (6-Sqrt[6])} }
But... we could get that same max value using x=0.
Abs[f[0,v]]//FullSimplify
1/50 (7-2 Sqrt[6])
Just thought it interesting. :>)
= = = = = = = = = = = =
Dana DeLouis
Mac & Math 8
= = = = = = = = = = = =
On Aug 4, 9:56 pm, Cisco Lane <travl... at yahoo.com> wrote:
> I cannot seem to find the corrrect maximum for the absolute value of the following function in 0<=x<=aa1
>
> aa1 = .7481
>
> f[x_, a_] = (a^3 - 6 x - a^2 (4 + x) + a (2 + 12 x - 4 x^2))/(8 a)
>
> For example, FindMaximum[{Abs[f[x, aa1]], 0 <= x <= aa1}, x] gives {0.0317268, {x -> 0.7481}}
>
> The correct answer is at x=0, where Abs[f[0,aa1]]=0.0540933 but I have tried every maximization function I can think of and nothing will give me the correct answer. Can anyone help?