MathGroup Archive 2005

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

Search the Archive

Re: refer to the result of FindRoot[ ]


On Fri, 21 Oct 2005 06:34:06 +0000 (UTC), perimeterbow at gmail.com wrote:
> FindRoot[] returns result in this format {x->2.123}, how can I get rid
> of the x-> so I can use the number directly to automate calculation
> flow?
> Thanks.

Use the operator "/." to perform the substitution.  For example, let's say you
want to evaluate 1-x^2/2+x^4/24, given that x is a root of the equation
"x==Cos[x]":

In[1]:= sol=FindRoot[x==Cos[x],{x,1}]

Out[1]= {x -> 0.739085}

In[2]:= 1-x^2/2+x^4/24 /. sol

Out[2]= 0.739309



-- 
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/index.cfm?action=book&bookid=228>


  • Prev by Date: Re: refer to the result of FindRoot[ ]
  • Next by Date: Save everything
  • Previous by thread: Re: refer to the result of FindRoot[ ]
  • Next by thread: Re: refer to the result of FindRoot[ ]