Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: FindMaximum query

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85559] Re: FindMaximum query
  • From: Daniel Huber <dh at metrohm.ch>
  • Date: Wed, 13 Feb 2008 07:25:52 -0500 (EST)
  • References: <foudug$m07$1@smc.vnet.net>

Hi Neely,
deine fun like:
fun[x_?NumericQ]
hope this helps, Daniel

E. Neely Atkinson wrote:
> Consider the following function:
> 
> fun[x_] :=
>  Module[
>   {y, sol},
>   sol = FindRoot[Sqrt[y] == Abs[x], {y, 0, 0.001}];
>   (* AppendTo[list, sol]; *)
>   -y /. sol[[1]]
>   ]
> 
> Then Plot[fun[x], {x, -2, 2}] works fine, but
> 
> FindMaximum[fun[x], {x, 1, 1.001}]
> 
> fails. If I uncomment the debug line in fun and execute 
> 
> list = {};
> FindMaximum[fun[x], {x, 1, 1.001}]
> 
> Then list contains
> 
> {FindRoot[Sqrt[y$21471] == Abs[x], {y$21471, 0, 0.001}]}
> 
> 
> So, FindRoot fails because x is passed through unevaluated, I think.
> I would appreciate any advice on how to get FindMaximum (or NMaximize)
> to work in this case.
> 
> Mathematic 6.0.1.0 x86 32 bit
> Mac OS X 10.4.11
> 
> Thanks very much,
> 
> E. Neely Atkinson
> Department of Biostatistics
> M. D. Anderson Cancer Center
> 
> neely at pdq.net
> 


  • Prev by Date: Re: NDSolve Singularity
  • Next by Date: Re: problem with Inset moving text
  • Previous by thread: FindMaximum query
  • Next by thread: Re: FindMaximum query