home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / sci / math / symbolic / 2308 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.8 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!ghost.dsi.unimi.it!37.1!sunthpi3.difi.unipi.it!campo
  2. Newsgroups: sci.math.symbolic
  3. Subject: Re: mathematica solve and rules
  4. Message-ID: <1992Sep3.091337.434@cine88.cineca.it>
  5. From: campo@sunthpi3.difi.unipi.it (Massimo Campostrini)
  6. Date: 3 Sep 92 09:13:37 +0100
  7. Reply-To: campo@sunthpi3.difi.unipi.it
  8. References: <1992Sep3.004655.21678@athena.mit.edu> <BtzEo8.A36@bunyip.cc.uq.oz.au>
  9. Distribution: world
  10. Organization: Istituto Nazionale di Fisica Nucleare, Pisa, Italy
  11. Nntp-Posting-Host: sunthpi3.difi.unipi.it
  12. Lines: 29
  13.  
  14. In article <BtzEo8.A36@bunyip.cc.uq.oz.au>, coates@newton.physics.uq.oz.au (Tony Coates) writes:
  15. |> 
  16. |>     "Solve[{a + b = 1, a - b = -1}, {a, b}]"
  17. |> gives
  18. |>     "{{ a -> 0, b -> 1}}".
  19. |> Usually, to use these rules, I would do something like
  20. |>     "subs = First[Solve[...]]"
  21. |> where the "First" is to get rid of the outer list braces, which I have
  22. |> never understood the reason for.  If you want to assign these values to
  23.                     --------------
  24.  
  25. The reason is that if you solve a (system of) polynomial (higher degree)
  26. equation(s) you will get a list of solutions:
  27.  
  28. In[1]:= Solve[{x^2+x+y==3, x-y==a}, {x,y}]
  29.  
  30.                                       -2 - 2 a + 2 Sqrt[4 + a]
  31. Out[1]= {{x -> -1 + Sqrt[4 + a], y -> ------------------------}, 
  32.                                                  2
  33.  
  34.                                   -2 - 2 a - 2 Sqrt[4 + a]
  35. >    {x -> -1 - Sqrt[4 + a], y -> ------------------------}}
  36.                                              2
  37.     
  38. -- 
  39.         Massimo Campostrini,  Theoretical Physicist,
  40. Istituto Nazionale di Fisica Nucleare, Sezione di Pisa,
  41. Piazza Torricelli 2, I-56126 Pisa, Italy  ||  Phone: (+39)(50)42093
  42. Internet: campo@sunthpi3.difi.unipi.it    ||  Fax:   (+39)(50)48277
  43.