Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4317 > unrolled thread
| Started by | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| First post | 2011-08-11 09:18 +0000 |
| Last post | 2011-08-11 09:18 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: ? Bill Rowe <readnews@sbcglobal.net> - 2011-08-11 09:18 +0000
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Date | 2011-08-11 09:18 +0000 |
| Subject | Re: ? |
| Message-ID | <j206pl$76d$1@smc.vnet.net> |
On 8/10/11 at 6:47 AM, david.kirkby@onetel.net (David Kirkby) wrote:
>The output of FindRoot[] when trying to find a root is like:
>{x -> 0.49454545}
>How can I convert that list, into the number 0.49454545?
>In[1]:= FindRoot[x+9,{x,-5}]
>Out[1]= {x -> -9.}
>In[2]:= Head[%]
>Out[2]= List
>I can't seem to find any "normal" operations on the list which give
>me the number.
The output from FindRoot is a list of replacement rules. When
there is a single replacement rule simply do
In[1]:= sol = FindRoot[x + 9, {x, -5}];
In[2]:= x /. sol
Out[2]= -9.
When there is more than one replacement rule you will need to
specify which solution you want. For example using Solve
In[3]:= sol = Solve[x^2 == 9, x];
In[4]:= x /. sol[[1]]
Out[4]= -3
In[5]:= x /. sol[[2]]
Out[5]= 3
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web