RE: FindMaximum doesn't work?
- To: mathgroup at smc.vnet.net
- Subject: [mg47814] RE: [mg47784] FindMaximum doesn't work?
- From: "DrBob" <drbob at bigfoot.com>
- Date: Tue, 27 Apr 2004 04:48:10 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Show us the code you REALLY used, or we can't help you. If test[c] is
defined the way you say in the post, it (a) has no global maximum and (b)
has no local maximum at 1.4. Even if you define it as follows, to enforce
the limits you mention, it still has no maximum at 1.4, and it doesn't have
the values at 5 and 1.4 that you show in the post. Nor is it decreasing in
c, near 2 or 5.
test[c_] /; 1.4 ? c < 6.2 :=
((10 - 185c + ((5^0.5)(20 + 19660c + 6641c^2))^2)(-41 -
134c + (5^0.5)(20 + 19660c + 6641c^2)))/(530604c)
FindMaximum[test[c], {c, 5}]
(error message)
{7.77508372302857*^10, {c -> 5.}}
FindMaximum[test[c], {c, 2}]
(error message)
{3.009388196803684*^9, {c -> 2.}}
DrBob
www.eclecticdreams.net
-----Original Message-----
From: Carol Ting [mailto:suomesta at yahoo.com]
To: mathgroup at smc.vnet.net
Subject: [mg47814] [mg47784] FindMaximum doesn't work?
Hi List,
I have one function which is defined only for a certain range of its
independent variable:
test[c_]:=((10-185c+((5^0.5)(20+19660c+6641c^2))^2)(-41-134c+(5^0.5)(20+1966
0c+6641c^2)))/(530604c)
1.4<=c<6.2
This function is decreasing in c so the maximum should be at 1.4.
However, when the initial guess I give is greater than 2.6,
FindMaximum only returns the values at that point.
For example,
In[57]:=FindMaximum[test[c],{c,5}]
Out[57]:={-0.895005,{c->5.}}
But when I give
In[58]:=FindMaximum[test[c],{c,2}]
Out[58]:={2.09973,{c->1.4}}
Then it works.
My program uses a While loop to generate piecewise functions (I only
put the piece containting the global maximum here). The maximum
condition is needed to decide whether to terminate the loop so I
cannot always stop the execution and keep throwing in different
guesses.
Did I do anything wrong, or is this a bug? Thanks a lot!
Carol