Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11225
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Problem finding maximum |
| Date | 2012-08-05 06:37 +0000 |
| Message-ID | <jvl4bt$77r$1@smc.vnet.net> (permalink) |
| References | <20120805014915.A5ED5684F@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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@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?
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Problem finding maximum Bob Hanlon <hanlonr357@gmail.com> - 2012-08-05 06:37 +0000 Re: Problem finding maximum Frank K <fkampas@gmail.com> - 2012-08-05 22:05 +0000
csiph-web