Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: FindRoot complains under version 5.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46168] Re: [mg46127] FindRoot complains under version 5.0
  • From: Hugh Walker <hwalker at gvtc.com>
  • Date: Mon, 9 Feb 2004 05:54:18 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Saturday, February 7, 2004, at 03:02 AM, Sebastian Kubis wrote:

> under version 4.1 I was used to nest FindRoot in another one in the
> following way:
>
> In[1]:= arcsin[y_] := x /. FindRoot[Sin[x] == y, {x, .3, .4}]
>
> In[2]:= sin[a_] := z /. FindRoot[arcsin[z] == a, {z, 0, .5}]
>
> but now, under ver 5.0 it reports error, although finally
> gets the correct result:
>
> In[3]:= sin[30 Degree]
>
> FindRoot::nlnum:
>    The function value {0.29552 - 1. z}
>    is not a list of numbers with dimensions {1} at {x} ={0.3}.
>
> ReplaceAll::reps:
>    {FindRoot[Sin[x] == z, {x, 0.3, 0.4}]}
>     is neither a list of replacement rules nor a valid dispatch table, 
> and so
>     cannot be used for replacing.
>
> Out[3]= 0.5
>
> What has changed in ver 5.0 ? How to avoid these "warnings"
>
> thanks
>
> Seb.

It appears that greater care is required in using FindRoot in Version 
5. As pointed out to me by Paul Abbott and others, one must take care 
that the arguments passed to FindRoot are numeric. In your case, the 
problem is fixed by modification of your function arcsin as follows:

arcsin[y_?NumericQ] := x /. FindRoot[Sin[x] == y, {x, .3, .4}]

Regards,
==========
Hugh Walker
Gnarly Oaks


  • Prev by Date: Re: random numbers?
  • Next by Date: Re: Mathematical Statistics
  • Previous by thread: FindRoot complains under version 5.0
  • Next by thread: FindRoot complains under version 5.0