MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem finding maximum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127583] Re: Problem finding maximum
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sun, 5 Aug 2012 02:34:51 -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
  • References: <20120805014915.A5ED5684F@smc.vnet.net>

f[x_, a_] = (a^3 - 6 x - a^2 (4 + x) +
     a (2 + 12 x - 4 x^2))/(8 a);

aa1 = .7481;

Plot[Abs[f[x, aa1]], {x, 0, aa1}]

"FindMaximum[f, x] searches for a local maximum in f, starting from an
automatically selected point."

FindMaximum[{Abs[f[x, aa1]],
  0 <= x <= aa1}, x]

{0.0317268, {x -> 0.7481}}

"FindMaximum[f, {x, x0}] searches for a local maximum in f, starting
from the point x = x0."

FindMaximum[{Abs[f[x, aa1]],
  0 <= x <= aa1}, {x, .1}]

{0.0540933, {x -> 1.*10^-7}}

You just needed to give it a better starting value than the default.
Alternatively, use NMaximize

"NMaximize always attempts to find a global maximum of f subject to
the constraints given."

NMaximize[{Abs[f[x, aa1]],
  0 <= x <= aa1}, x]

{0.0540933, {x -> 0.}}


Bob Hanlon


On Sat, Aug 4, 2012 at 9:49 PM, Cisco Lane <travlorf 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?
>



  • Prev by Date: How to Extract Conditional Expression?
  • Next by Date: Re: Why no OSX SystemDialogInput["RecordSound"]?
  • Previous by thread: Problem finding maximum
  • Next by thread: Re: Problem finding maximum