Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11239 > unrolled thread
| Started by | Cisco Lane <travlorf@yahoo.com> |
|---|---|
| First post | 2012-08-06 08:40 +0000 |
| Last post | 2012-08-15 09:28 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Problem finding maximum Cisco Lane <travlorf@yahoo.com> - 2012-08-06 08:40 +0000
Re: Problem finding maximum Peter Pein <petsie@dordos.net> - 2012-08-15 09:28 +0000
| From | Cisco Lane <travlorf@yahoo.com> |
|---|---|
| Date | 2012-08-06 08:40 +0000 |
| Subject | Re: Problem finding maximum |
| Message-ID | <jvnvte$ce1$1@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.
[toc] | [next] | [standalone]
| From | Peter Pein <petsie@dordos.net> |
|---|---|
| Date | 2012-08-15 09:28 +0000 |
| Message-ID | <k0fq34$qv2$1@smc.vnet.net> |
| In reply to | #11239 |
Am 06.08.2012 10:40, schrieb Cisco Lane:
> 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.
>
Seemingly there is a bug in version 7:
NMaximize[{Abs[f[x, aa1]], 0 <= x <= aa1}, x,
Method -> {Automatic, "InitialPoints" -> List /@ Range[0, 3] aa1/3}]
{0.0274936, {x -> 0.403948}}
Even if the global maximum location is in the set of initial points, the
default method fails in this case.
This does not happen any more in version 8.
If an upgrade is no option, try Bob's tip using specific Methods.
You can learn a lot about Mathematica 7 if you try every example in the
tutorial [1] written for version 8, I guess ;)
Peter
[1]
http://www.wolfram.com/learningcenter/tutorialcollection/ConstrainedOptimization/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web