MathGroup Archive 2004

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

Search the Archive

Re: FindMaximum doesn't work?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47952] Re: FindMaximum doesn't work?
  • From: suomesta at yahoo.com (Carol Ting)
  • Date: Sun, 2 May 2004 04:50:50 -0400 (EDT)
  • References: <c6l8p2$iv6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

My bad.  I copied it manually and sure enough a couple of typos
sneaked in and messed things up.

Here is the function which I tried to apply FindMaximum to:

Test[c_]:=-10 + (1/(530604*c))*((10 - 185*c + Sqrt[5]*Sqrt[20 +
19660*c + 6641*c^2])^2*(-41 - 134*c + Sqrt[5]*Sqrt[20 + 19660*c +
6641*c^2]))/;(c<=1.4<6.2)

If you plot the function you will see it's decreasing in c with the
maximum at 1.4.  But unless I choose an initial guess of c less than
2.6 Mathematica just throws my guesses back at me.  Again, the old
examples:

In[57]:=FindMaximum[test[c],{c,5}]
Out[57]:={-0.895005,{c->5.}}
 
Any one has an idea of what's going on?  Thanks!


Carol


"DrBob" <drbob at bigfoot.com> wrote in message news:<c6l8p2$iv6$1 at smc.vnet.net>...
> 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: [mg47952]  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


  • Prev by Date: RE: Re: bug in IntegerPart ?
  • Next by Date: Re: bug in IntegerPart ?
  • Previous by thread: Re: Fitting a Cylinder to 3D data points
  • Next by thread: kuen surface