Ask Your Question
0

Solving a simple system of equations

asked 2012-01-07 12:15:49 +0100

Balder gravatar image

updated 2012-01-07 13:16:37 +0100

DSM gravatar image

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 flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2012-01-07 22:22:56 +0100

Volker Braun gravatar image

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.

edit flag offensive delete link more
0

answered 2012-01-07 16:16:30 +0100

Emil Widmann gravatar image

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)

I then get the answer

[[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?

edit flag offensive delete link more

Comments

@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.

DSM gravatar imageDSM ( 2012-01-07 19:05:48 +0100 )edit
0

answered 2012-01-07 13:06:31 +0100

Emil Widmann gravatar image

updated 2012-01-07 13:06:56 +0100

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

edit flag offensive delete link more

Comments

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...??

Balder gravatar imageBalder ( 2012-01-07 14:25:45 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2012-01-07 12:15:49 +0100

Seen: 17,163 times

Last updated: Jan 07 '12