Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: How do you input a solution from FindRoot into another equation?

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg754] Re: How do you input a solution from FindRoot into another equation?
  • From: dm5579 at glibm19.cen.uiuc.edu (Demetri Mouratis)
  • Date: 13 Apr 1995 01:43:59 GMT
  • Organization: UIUC Engineering Workstation Labs

In article <3mfauj$l4o at news0.cybernetics.net>, rdack at acs.ucalgary.ca (Robert Dack) writes:
|> 
|> Can someone tell me how to take the output from the FindRoot
|> cammand and input it into the next command line?  The output
|> comes out in the form { x -> 2.435 }, so the usual [%] command on
|> the next line won't work.
|> 
|> Any help in this area would be appriciated
|> 
|> R Dack   rdack at acs.ucalgary.ca
|> 
|> 
|> 
|> 
Sure.

The FindRoot command, returns a list as a solution.  In your case the list is
{x -> 2.435}.  You want to get at an element within that list, the root.  The 
Mathematica Part command allows you to do this.  Here's an example:

In[1]:=
FindRoot[Sin[x]==0,{x,3}]
Out[1]:=
{x -> 3.14159}
In[2]:=
%[[1]] 
Out[2]:=
x -> 3.14159
In[3]:=
%[[2]]
Out[3]:=
3.14159

You can combine the two steps into %[[1,2]] and get the same thing.


  • Prev by Date: Re: Accuracy and Precision
  • Next by Date: Re: How do you input a solution from FindRoot into another equation?
  • Previous by thread: Re: PolarPlot ???
  • Next by thread: Re: How do you input a solution from FindRoot into another equation?