Re: Help! FindRoot output to list...
- To: mathgroup at smc.vnet.net
- Subject: [mg30989] Re: Help! FindRoot output to list...
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 29 Sep 2001 04:19:10 -0400 (EDT)
- References: <9p2q0q$317$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Joachim,
The rule form is designed to help us use the solution(s):
xysol=FindRoot[{x^2+y^2==1,y==x Exp[x]},{x,0.1},{y,0.5}]
{x -> 0.5134886100441767, y -> 0.858096409132671}
{x,y}/.xysol
{0.5134886100441767, 0.858096409132671}
This list of numbers is only usable if we feed it into a calculation (and we
need to remember which goes with x and which with y)
With the rules can use replacement to substitute in gerneral expressions
x^2 + Sin[y] /. xysol
{0.26367055264510053, 0.7565992165586678}
More generally, we will have several solutions:
Solve[{x^2 + y^2 == 10, x + y == 2}, {x, y}]
{{x -> -1, y -> 3}, {x -> 3, y -> -1}}
Each inner list gives one of the two solutions.
We can find substitute into an expression and see what each solution gives:
x^2 + Sin[y] /. %
{1 + Sin[3], 9 - Sin[1]}
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Joachim Almergren" <joal at sissa.it> wrote in message
news:9p2q0q$317$1 at smc.vnet.net...
>
> 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-
>