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


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

Re: ?

Started byMurray Eisenberg <murray@math.umass.edu>
First post2011-08-11 09:22 +0000
Last post2011-08-11 09:22 +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: ? Murray Eisenberg <murray@math.umass.edu> - 2011-08-11 09:22 +0000

#4324 — Re: ?

FromMurray Eisenberg <murray@math.umass.edu>
Date2011-08-11 09:22 +0000
SubjectRe: ?
Message-ID<j2070b$77u$1@smc.vnet.net>
This is something that arises even from plain Solve as well as DSolve, 
etc.: you get rules instead of values.

Given a rule x -> val, the typical way you get the value val is:

    x /. x -> val

This in your case either directly...

   x /. FindRoot[x+9,{x,-5}]

... or else in two steps:

   FindRoot[x+9,{x,-5}]
   x /. %

Note that for things like Solve where multiple solutions are possible, 
the result of the x /. rule expression will be a list of the solutions. 
For example:

   x /. Solve[x^2 + 4 == 0, x]
{-2I, 2I}


On 8/10/11 6:47 AM, 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.
>
> Dave
>

-- 
Murray Eisenberg                     murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

[toc] | [standalone]


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


csiph-web