Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15648 > unrolled thread

Re: Parculiarities of FindRoot

Started by"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
First post2011-02-01 11:53 +0000
Last post2011-02-01 11:53 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Parculiarities of FindRoot "Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com> - 2011-02-01 11:53 +0000

#15648 — Re: Parculiarities of FindRoot

From"Sjoerd C. de Vries" <sjoerd.c.devries@gmail.com>
Date2011-02-01 11:53 +0000
SubjectRe: Parculiarities of FindRoot
Message-ID<ii8s75$2mc$1@smc.vnet.net>
You define Func such that it only works for numeric input (try giving
it a symbolic input and see what happens).

One of the first steps  of FindRoot involves the symbolic evaluation
of the function to find the derivative, which in this case is
unsuccessful. Changing the definition of Func slightly, so that it
tests for its arguments being numeric helps:

In[24]:= ClearAll[Func];
Func[y_?NumericQ] := x^2 /. FindRoot[x + y == 0, {x, 0.}]
Func[.2]
FindRoot[Func[z] == 0, {z, 0.}]

Out[26]= 0.04

Out[27]= {z -> 0.}

Cheers -- Sjoerd


On Jan 31, 9:24 am, Tianhui Li <tianh...@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web