MathGroup Archive 2011

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

Search the Archive

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



  • Prev by Date: How to start new input line?
  • Next by Date: Syntax question
  • Previous by thread: Re: How to start new input line?
  • Next by thread: Re: Parculiarities of FindRoot