home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!rutgers!cmcl2!wissel!jcao
- From: jcao@wissel.GBA.NYU.EDU (Jingbin Cao)
- Newsgroups: sci.math.symbolic
- Subject: Re: Mma Solve[] oddity (a much shorter version)
- Keywords: Solve, oddity
- Message-ID: <29136@wissel.GBA.NYU.EDU>
- Date: 27 Aug 92 05:52:43 GMT
- References: <28914@option.GBA.NYU.EDU> <1992Aug23.215353.3637@u.washington.edu>
- Organization: NYU Stern School of Business
- Lines: 131
-
- In article <1992Aug23.215353.3637@u.washington.edu> petry@runners.math.washington.edu (David Petry) writes:
- >In article <28914@option.GBA.NYU.EDU> jcao@option.GBA.NYU.EDU (Jingbin Cao) writes:
- >>The following log documents some weired Solve[] oddities. They are:
- >>
- >> 1. Solve[] cannot find roots in some cases, at least not within
- >> reasonable period of time. But if you divide the equations
- >> by something, Solve[] finds some roots!
- >
- >[long transcript deleted]
- >
- >Here's a simple example of what Jingbin Cao is getting at (I think):
- >
- >eqs = { a*x*y + b*x + c*y ==0, d*x*y + e*x + f*y + g == 0}
- >
- >Solve[ eqs, {x,y}]
- >
- >Mathematica 2. seems to be unable to solve the above equations, but if we
- >divide out the "a" and "d", so that
- >
- >eqs = { x*y + b*y + c*x == 0, x*y + e*x + f*y + g == 0}
- >
- >then Mathematica gets the answer right away.
-
- After reading a few replies, I want to point out that David Petry's
- case is different from mine. In my case, mma is unable to solve a
- equation. But after dividing the equation by some junk, mma is able to
- solve the resulting _MORE COMPLICATED_ equation with ease. (In my
- original post I also claimed that Solve[] missed some solutions. It
- turned out the missing ones make the junk zero.)
-
- In contrast, in the follow-up posts, people showed cases in
- which mma is unable to solve some equations. But after some
- simplifications, the equations get solved. The latter cases are easier
- to understand, IMHO, than the example I gave. That's why I called it
- odd.
-
- To further illustrate the magic of dividing-by-some-junk,
- here's another (shorter) script for you entertainment. The point I try
- to make in this case is that Factor[] is unable to factor an
- expression, v2u11. But after dividing v2u11 by some junk, (x-1/2), and
- invoking Factor[] twice, Factor somehow worked. Comments are enquoted
- by (* and *).
-
- In[42]:= v2u11=%40 (* This shows v2u11 *)
-
- 2
- Out[42]= -b1 + b2 + 5 n - 5 n q - 4 x2 - 4 n x2 + 4 n q x2 + 3 x2 +
-
- 2
- > 2 (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]) -
-
- 2
- > 2 x2 (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]) +
-
- 2 2
- (-2 + 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])
- > ------------------------------------------------------
- 4
-
- In[43]:= Solve[v2u11==0, x2]
-
- b1 b2
- 1 + n - --------- + --------- - n q
- 1 n (1 - q) n (1 - q)
- Out[43]= {{x2 -> -}, {x2 -> -----------------------------------}}
- 2 2
-
- (* So x2=1/2 is a root to v2u11==0. Can we Factor v2u11?
- No. As is shown below: *)
-
- In[44]:= Factor[v2u11]
-
- 2
- Out[44]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2 +
-
- 2
- > 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] -
-
- 2
- > 4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
-
- (* Now, how about dividing v2u11 by somthing? Actually, I was
- thinking to divide v2u11 by x2-1/2, but I typed x-1/2 *)
-
- In[45]:= Factor[v2u11/(x-1/2)]
-
- 2
- Out[45]= (2 (-2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2 +
-
- 2
- > 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] -
-
- 2
- > 4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])) / (-1 + 2 x)
-
- (* It does not work yet. How about one more time? *)
-
- In[46]:= Factor[%]
-
- Out[46]= (4 (-1 + 2 x2) (1 - n + n q + x2 -
-
- 2
- > Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ])) / (-1 + 2 x)
-
- (* (x2-1/2) is factored out!!! *)
-
- (* Now, how about applying Factor[] twice to v2u11?? *)
-
- In[47]:= Factor[v2u11]
-
- 2
- Out[47]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2 +
-
- 2
- > 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] -
-
- 2
- > 4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
-
- In[48]:= Factor[v2u11]
-
- 2
- Out[48]= -2 + 2 n - 2 n q + 2 x2 - 4 n x2 + 4 n q x2 + 4 x2 +
-
- 2
- > 2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ] -
-
- 2
- > 4 x2 Sqrt[1 + b1 - b2 - 3 n + 3 n q + 2 x2 + x2 ]
-
- (* Nothing happened. *)
-