Re: Simultaneous equation problem - too many variables?
- To: mathgroup@smc.vnet.net
- Subject: [mg11357] Re: Simultaneous equation problem - too many variables?
- From: weber@math.uni-bonn.de (Matthias Weber)
- Date: Sat, 7 Mar 1998 02:06:31 -0500
- Organization: RHRZ - University of Bonn (Germany)
- References: <6do484$lo3@smc.vnet.net>
In article <6do484$lo3@smc.vnet.net>, "Richard Anderson" <richardj.anderson@stonebow.otago.ac.nz> wrote: > Greetings everyone, > > I have a problem in population genetics that yields the following > equations: > > Out[84]//InputForm= > us = (u*(1 + 2*v + h*t*(-1 + \[Theta])) + > v*(1 + h*t*(-1 + \[Theta]) - t*\[Theta]))/ > (2 + u + v + t*(-2 + h*(u + v)*(-1 + \[Theta]) - > v*\[Theta])) > > Out[82]//InputForm= > vs = (u*(1 + 2*v + k*s*(-1 + \[Theta])) + > v*(1 + k*s*(-1 + \[Theta]) - s*\[Theta]))/ > (2 + u + v + s*(-2 + k*(u + v)*(-1 + \[Theta]) - > v*\[Theta])) > > u and v are variables. k,h,s,t, and \[Theta] are constants (0 <= k <= 1, > 0 <= h <= 1, -1 < s < 1, -1 < t < 1). I've tried using > SetAttributes[s,Constant] and so on, but that doesn't help with the > following problem. > > I am interested in the solutions of the simultaneous equations {us == u, > vs == v}. (Please note that us and vs are separate variables, not u*s > and v*s). A previous question to MathGroup yielded the following idea > which works for simpler cases of the same kind of problem (the method > puts (us-u) and (vs -v) over a common denominator so that the problem > becomes one of solving for the numerator = 0). > > equations ={us==u,vs==v}; > polys=Map[#[[1]]-#[[2]]&,equations]; newpolys= > Map[Numerator[Together[#]]&,polys]; Reduce[newpolys==0,{u,v}]; > > However, in this case, Mathematica(v.3.0.1 running on a Pentium 200 MHz > and Win 95), runs out of memory, presumably because there are too many > variables. (As a concession, I can justifiably allow h=k, but if > possible would like to avoid it. Even with h=k, Mathematica fails to > solve) I've tried a number of substitutions - e.g. A = 1 + k s(-1 + > \[Theta]), B = A - t \[Theta] (and similarly in the equation for vs), > to no avail. > u1=us-u//Together//Numerator; v1=vs-v//Together//Numerator; Reduces your problem to u1==0 and v1==0. Luckily, u1 is only linear in v, so Solve[u1==0,v] (v1/.%[[1]]) //Together//Cancel//Numerator; produces a single equation in u (and your constants). However, this is of fourth order with a single factor u (giving the solution u=0, v=0 in which you are probably not interested). So you still have to deal with with a third order equation in u. This is possible using Solve even on a small 66MHz PowerMac, but won't delight you. A general rule for solving polynomial equations with Mathematica seems to be to avoid that Mathematica solves non-linear equations at any intermediate step. Sometimes the Groebner basis techniques used by Solve lead to impressive results, but if this fails (as here, due to the nature of the problem), Mathematica tries to solve the problem by brute force. Matthias