Re: Parculiarities of FindRoot
- To: mathgroup at smc.vnet.net
 - Subject: [mg116089] Re: Parculiarities of FindRoot
 - From: Bob Hanlon <hanlonr at cox.net>
 - Date: Tue, 1 Feb 2011 06:55:14 -0500 (EST)
 
Func can only be evaluated with a numeric argument, Use
Func[y_?NumericQ] := x^2 /. FindRoot[x + y == 0, {x, 0.}]
Bob Hanlon
---- Tianhui Li <tianhuil at princeton.edu> wrote: 
=============
Here's a question for the group: in the following function, Func seems
to evaluate numerical arguments correctly and *works* when you throw
it into a FindRoot.  But the second command generates a lot of warning
messages.  Does anyone understand why?
Func[y_] := x^2 /. FindRoot[x + y == 0, {x, 0.}]
Func[.2]
FindRoot[Func[z], {z, 0.}]
Warm Regards,
Michael Li
Bendheim Center for Finance
Princeton University
Princeton, NJ 08544