Re: Help! FindRoot output to list...
- To: mathgroup at smc.vnet.net
- Subject: [mg30981] Re: [mg30958] Help! FindRoot output to list...
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Sat, 29 Sep 2001 04:19:00 -0400 (EDT)
- References: <200109280755.DAA01716@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Since you already mention that the output is a list, you're close to the
solution. It is very important that you grasp what's going on. Example:
In[1]:=
r = FindRoot[x - 4 == 0, {x, 0}]
Out[1]=
{x -> 4.}
In[2]:=
FullForm[r]
Out[2]//FullForm=
List[Rule[x, 4.`]]
Here you see that the result is indeed a list *with only one element*. This
element you extract with
In[3]:=
r[[1]]
Out[3]=
x->4.
and then, the value you want is
In[4]:=
r[[1,2]]
Out[4]=
4.
But you may also use a ReplaceAll command to directly have the root
available:
In[5]:=
x/.r
Out[5]=
4.
or even more directly
In[6]:=
x/.FindRoot[x - 4 == 0, {x, 0}]
Out[6]=
4.
Tomas Garza
Mexico City
----- Original Message -----
From: "Joachim Almergren" <joal at sissa.it>
To: mathgroup at smc.vnet.net
Subject: [mg30981] [mg30958] Help! FindRoot output to list...
>
> I would be extremely thankful to anyone
> who can provide me with a solution for
> converting the FindRoot output list to
> a list of the 'usable' numbers.
> (With other word getting rid of the "x->"
> part of the list.)
>
> Thanks in advance,
> -joachim-
>
- References:
- Help! FindRoot output to list...
- From: Joachim Almergren <joal@sissa.it>
- Help! FindRoot output to list...