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: [mg771] Re: How do you input a solution from FindRoot into another equation?
  • From: j-guyer at nwu.edu (Jon Guyer)
  • Date: Tue, 18 Apr 1995 01:05:15 -0400
  • Organization: Northwestern University, Evanston, IL

In article <3mieag$cl0 at news0.cybernetics.net>,
wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner) wrote:

>You can extract the right-hand side of a rule by subscripting part 2:

[bizarre (no offense, Dave) machinations with sublists omitted]

In[1]:=     FindRoot[BesselJ[0,x], {x,2.}]

Out[1]= {x -> 2.40483}

In[2]:= x/.%

Out[2]= 2.40483

In[3]:=     Solve[x^2==2, x]

Out[3]= {{x -> -Sqrt[2]}, {x -> Sqrt[2]}}

In[4]:= x/.%

Out[4]= {-Sqrt[2], Sqrt[2]}

In[5]:=     Solve[{x^2-2 == y, x+y==0}]

Out[5]= {{y -> -1, x -> 1}, {y -> 2, x -> -2}}

In[6]:= x/.%

Out[6]= {1, -2}

In[7]:= y/.%%

Out[7]= {-1, 2}

In[8]:= {x,y}/.%5

Out[8]= {{1, -1}, {-2, 2}}


Use the "/." (ReplaceAll) operator. It saves _much_ trouble in figuring
out which subscript to use. It's what you're "supposed" to use in this
case. The definition for this operator is 
"expr /. x -> value     replace 'x' by 'value' in the expression 'expr'"

-- 
Jonathan E. Guyer                        j-guyer at nwu.edu


  • Prev by Date: Re: FactorInteger Print Formatting
  • Next by Date: Re: - FFT and Mathematica
  • Previous by thread: Re: How do you input a solution from FindRoot into another equation?
  • Next by thread: Re: How do you input a solution from FindRoot into another equation?