Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Problem finding maximum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127602] Re: Problem finding maximum
  • From: Cisco Lane <travlorf at yahoo.com>
  • Date: Mon, 6 Aug 2012 04:37:48 -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

Hmm - My Mathematica (Mathematica 7 Home Edition, Ver 7.0.1.0, Mac OS X X86 (32-bit)) gives a different answer:

f[x_, a_] = (a^3 - 6 x - a^2 (4 + x) + a (2 + 12 x - 4 x^2))/(8 a);
aa1 = .7481;
NMaximize[{Abs[f[x, aa1]], 0 <= x <= aa1}, x]

{0.0274936, {x -> 0.403948}}

Any idea why? I must use an automatically selected start point, because the values of aa1 vary widely.

Using the rational aa1 and Maximize works:

f[x_, a_] = (a^3 - 6 x - a^2 (4 + x) + a (2 + 12 x - 4 x^2))/(8 a);
aa1 = 7481/10000;
N[Maximize[{Abs[f[x, aa1]], 0 <= x <= aa1}, x]]

{0.0540933, {x -> 0.}}

but I am not sure why. If this method is reliable, I could use it, but it seems klugy.



  • Prev by Date: Functions That Remember Values They Have Found
  • Next by Date: Re: Strange runtime error in Compiled function
  • Previous by thread: Re: Problem finding maximum
  • Next by thread: Re: Problem finding maximum