# Solving a simple system of equations

Hey Guys,

New to Sage and just trying to solve a simple system of equations. The system is below:

x,y,z,w,ha,hb,e,c = var('x y z w ha hb e c')

f1 = (c*(x+y)*(ha-x))-(e*x)

f2 = (c*(z+w)*(ha-x-z))-(c*z*(x+y)) - (e*z)

f3 = (c*(x+y)*(hb-y-w))-(c*y*(z+w)) - (e*y)

f4 = (c*(z+w)*(hb-w))-(e*w)

I want to find the equilibrium solutions, solving for x, y, z, w, when equations f1-f4 are equal to zero. So I try:

solve([f1==0,f2==0,f3==0,f4==0],x,y,z,w)

Unfortunately this causes Sage to hang (or it takes a remarkably long time to solve that I interrupt the process). This problem shouldn't be difficult to solve, but I am at a loss as to what to do. Perhaps I am going about this the wrong way??

edit retag close merge delete

Sort by ยป oldest newest most voted

I replaced cz with c * z and cy with c * y and got a (somewhat lengthy) solution immediatly. Does this solve it?

more

Hey, thanks for the answer. Unfortunately I am not following what you did. Where exactly did you make the change? In my original code I see no cz or cy...??

( 2012-01-07 14:25:45 +0200 )edit

I think your original question was edited, because when I answered before there were the lines

f2 = (c(z+w)(ha-x-z))-(cz*(x+y)) - (e*z)
f3 = (c(x+y)(hb-y-w))-(cy*(z+w)) - (e*y)

I added multiplication signs between cz and cy and pasted the following code into the cell

x,y,z,w,ha,hb,e,c = var('x y z w ha hb e c')
f1 = (c(x+y)(ha-x))-(e*x)
f2 = (c(z+w)(ha-x-z))-(c*z(x+y)) - (e*z)
f3 = (c(x+y)(hb-y-w))-(c*y(z+w)) - (e*y)
f4 = (c(z+w)(hb-w))-(e*w)
solve([f1==0,f2==0,f3==0,f4==0],x,y,z,w)

[[x == (c*e*hb - e^2*hb + (2*c^2 - e^3 + (c^2 + c)*e - e^2 + 3*c +
1)*ha)/(4*c^2 - e^4 + (c^2 - 1)*e^2 - 2*e^3 + 2*(2*c^2 + c)*e + 4*c +
1), y == -(e^3*hb - (c*hb - hb)*e^2 - c*e*hb - (c*e^2 - (c^2 - 2*c -
1)*e - 2*c^2 - c)*ha)/(4*c^2 - e^4 + (c^2 - 1)*e^2 - 2*e^3 + 2*(2*c^2 +
c)*e + 4*c + 1), z == (c*e^2*hb - 2*c^2*hb - (c^2*hb - 2*c*hb - hb)*e +
((c - 1)*e^2 - e^3 + c*e)*ha - c*hb)/(4*c^2 - e^4 + (c^2 - 1)*e^2 -
2*e^3 + 2*(2*c^2 + c)*e + 4*c + 1), w == -(e^3*hb - 2*c^2*hb + e^2*hb -
(c*e - e^2)*ha - (c^2*hb + c*hb)*e - 3*c*hb - hb)/(4*c^2 - e^4 + (c^2 -
1)*e^2 - 2*e^3 + 2*(2*c^2 + c)*e + 4*c + 1)]]

I just see that * sign is removed from normal text postings on this site, so your original system probably contained all *. In the current form with all * I get no solution either. - sorry

PS: Question to the site admins: Is it a bug or a feature of this site that * is removed?

more

@Emil Widmann: I'm not a site admin, but I can explain. It's a feature, although it's often troublesome for us mathy types: the asterisk is used to put things in italics (e.g. *fred*). I edited the original post to use the code blocks to get the formatting right when I saw that it had led to a misunderstanding.

( 2012-01-07 19:05:48 +0200 )edit

You should be using Groebner bases (and the Singular interface) instead of general purpose symbolics (via Maxima) for systems of polynomial equations. The standard way of doing what you want is to compute a lexicographic Groebner basis along the lines of what I commented here.

more