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

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!rutgers!cmcl2!wissel!jcao
  2. From: jcao@wissel.GBA.NYU.EDU (Jingbin Cao)
  3. Newsgroups: sci.math.symbolic
  4. Subject: Re: Mma Solve[] oddity (a much shorter version)
  5. Keywords: Solve, oddity
  6. Message-ID: <29136@wissel.GBA.NYU.EDU>
  7. Date: 27 Aug 92 05:52:43 GMT
  8. References: <28914@option.GBA.NYU.EDU> <1992Aug23.215353.3637@u.washington.edu>
  9. Organization: NYU Stern School of Business
  10. Lines: 131
  11.  
  12. In article <1992Aug23.215353.3637@u.washington.edu> petry@runners.math.washington.edu (David Petry) writes:
  13. >In article <28914@option.GBA.NYU.EDU> jcao@option.GBA.NYU.EDU (Jingbin Cao) writes:
  14. >>The following log documents some weired Solve[] oddities. They are:
  15. >>
  16. >>    1. Solve[] cannot find roots in some cases, at least not within
  17. >>       reasonable period of time. But if you divide the equations
  18. >>       by something, Solve[] finds some roots!
  19. >
  20. >[long transcript deleted]
  21. >
  22. >Here's a simple example of what Jingbin Cao is getting at (I think):
  23. >
  24. >eqs  =  {  a*x*y + b*x + c*y ==0,  d*x*y + e*x + f*y + g == 0}
  25. >
  26. >Solve[ eqs, {x,y}]
  27. >
  28. >Mathematica 2.  seems to be unable to solve the above equations, but if we 
  29. >divide out the "a" and "d", so that
  30. >
  31. >eqs = { x*y + b*y + c*x == 0,  x*y + e*x + f*y + g == 0}
  32. >
  33. >then Mathematica gets the answer right away.
  34.  
  35. After reading a few replies, I want to point out that David Petry's
  36. case is different from mine. In my case, mma is unable to solve a
  37. equation. But after dividing the equation by some junk, mma is able to
  38. solve the resulting _MORE COMPLICATED_ equation with ease. (In my
  39. original post I also claimed that Solve[] missed some solutions. It
  40. turned out the missing ones make the junk zero.)
  41.  
  42.     In contrast, in the follow-up posts, people showed cases in
  43. which mma is unable to solve some equations. But after some
  44. simplifications, the equations get solved. The latter cases are easier
  45. to understand, IMHO, than the example I gave. That's why I called it
  46. odd.
  47.  
  48.     To further illustrate the magic of dividing-by-some-junk,
  49. here's another (shorter) script for you entertainment. The point I try
  50. to make in this case is that Factor[] is unable to factor an
  51. expression, v2u11. But after dividing v2u11 by some junk, (x-1/2), and
  52. invoking Factor[] twice, Factor somehow worked. Comments are enquoted
  53. by (* and *).
  54.  
  55. In[42]:= v2u11=%40    (* This shows v2u11 *)
  56.  
  57.                                                                  2
  58. Out[42]= -b1 + b2 + 5 n - 5 n q - 4 x2 - 4 n x2 + 4 n q x2 + 3 x2  + 
  59.  
  60.                                                          2
  61. >    2 (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]) - 
  62.  
  63.                                                             2
  64. >    2 x2 (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]) + 
  65.  
  66.                                                        2  2
  67.      (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])
  68. >    ------------------------------------------------------
  69.                                4
  70.  
  71. In[43]:= Solve[v2u11==0, x2]
  72.  
  73.                                        b1          b2
  74.                             1 + n - --------- + --------- - n q
  75.                  1                  n (1 - q)   n (1 - q)
  76. Out[43]= {{x2 -> -}, {x2 -> -----------------------------------}}
  77.                  2                           2
  78.  
  79.     (* So x2=1/2 is a root to v2u11==0. Can we Factor v2u11?
  80.        No. As is shown below: *)
  81.  
  82. In[44]:= Factor[v2u11]
  83.  
  84.                                                            2
  85. Out[44]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2  + 
  86.  
  87.                                                  2
  88. >    2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] - 
  89.  
  90.                                                     2
  91. >    4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
  92.  
  93.     (* Now, how about dividing v2u11 by somthing? Actually, I was
  94.        thinking to divide v2u11 by x2-1/2, but I typed x-1/2 *)
  95.  
  96. In[45]:= Factor[v2u11/(x-1/2)]
  97.  
  98.                                                                2
  99. Out[45]= (2 (-2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2  + 
  100.  
  101.                                                      2
  102. >        2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] - 
  103.  
  104.                                                         2
  105. >        4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])) / (-1 + 2 x)
  106.  
  107.     (* It does not work yet. How about one more time? *)
  108.  
  109. In[46]:= Factor[%]
  110.  
  111. Out[46]= (4 (-1 + 2 x2) (1 - n + n q + x2 - 
  112.  
  113.                                                    2
  114. >        Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])) / (-1 + 2 x)
  115.  
  116.     (* (x2-1/2) is factored out!!! *)
  117.  
  118.     (* Now, how about applying Factor[] twice to v2u11?? *)
  119.  
  120. In[47]:= Factor[v2u11]
  121.  
  122.                                                            2
  123. Out[47]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2  + 
  124.  
  125.                                                  2
  126. >    2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] - 
  127.  
  128.                                                     2
  129. >    4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
  130.  
  131. In[48]:= Factor[v2u11]
  132.  
  133.                                                            2
  134. Out[48]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2  + 
  135.  
  136.                                                  2
  137. >    2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] - 
  138.  
  139.                                                     2
  140. >    4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
  141.  
  142.     (* Nothing happened. *)
  143.