FindMaximum query
- To: mathgroup at smc.vnet.net
- Subject: [mg85530] FindMaximum query
- From: "E. Neely Atkinson" <eatkinso at mdanderson.org>
- Date: Wed, 13 Feb 2008 04:21:29 -0500 (EST)
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