First time here? Check out the FAQ!

Ask Your Question
0

Solving a simple system of equations

asked 13 years ago

Balder gravatar image

updated 13 years ago

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

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
3

answered 13 years ago

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.

Preview: (hide)
link
0

answered 13 years ago

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?

Preview: (hide)
link

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 ( 13 years ago )
0

answered 13 years ago

Emil Widmann gravatar image

updated 13 years ago

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

Preview: (hide)
link

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 ( 13 years ago )

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: 13 years ago

Seen: 17,926 times

Last updated: Jan 07 '12