MathGroup Archive 2004

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

Search the Archive

Re: Simple question

  • To: mathgroup at
  • Subject: [mg48087] Re: Simple question
  • From: Paul Abbott <paul at>
  • Date: Tue, 11 May 2004 05:20:12 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <c7fi8a$oda$>
  • Sender: owner-wri-mathgroup at

In article <c7fi8a$oda$1 at>,
 George Kamin <gwkamin at> wrote:

> This is simple question, but I do not know how to go about searching for it 
> in this user groups data base. I also could not find a reference to the 
> solution in the "Mathematica Book". How does one assign the result of 
> Solve[.] or FindRoot[.] in the form {x1-> 3.14,x2->0.763} to the two 
> variables y1,y2 respectively?? 

Others have answered your question -- but I should ask you _why_ you 
want to assign the values (returned as rules) to variables? The idea of 
returning results as a list of replacement rules is to avoid explicit 
variable assignments.

If you have

   vals = {x1-> 3.14,x2->0.763};

then you can substitute these values into any expression involving x1 
and/or x2. For example

   x1^2 - x2 /. vals


  ContourPlot[Evaluate[(x-x1)^2+(y-x2)^2 /. vals], {x,-5,5}, {y,-1,1}];

Sometimes variable assignment is desirable or required but, usually, the 
above approach is preferable.


Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at 

  • Prev by Date: RE: Re: Mandelbrot Set & Mathematica
  • Next by Date: Re: Eliminate duplicates using Union [] in a
  • Previous by thread: Re: Simple question
  • Next by thread: Building List