Ask Your Question

Symbolic solution not fully solved?

asked 2017-05-15 05:26:33 +0200

fluxcalculator gravatar image

I'm not a mathematician, and only barely literate as a programmer, so please excuse me if I've overlooked something simple.

I'm using sage to make plots to help in the design of heating elements.

For the first iteration of my solution I could solve/check everything by hand but when trying to include load dependent voltage sag the equations became unwieldy and I want to use sage to symbolically solve the equations involved.

For most of the equations I've entered, when I use "solve" on the symbolic expression it places the element that I wanted to solve for on the lhs of the equation, followed by an expression completely devoid of that term on the rhs. This is what I want.


Rl,Rp,W,Vb,Rho,L,r,pi,F = var('Rl,Rp,W,Vb,Rho,L,r,pi,F')
eq42 = solve((Vb^2 * Rl)/(Rp + Rl)^2 == W, Rl)


[Rl == 1/2*(Vb^2 - 2*Rp*W - sqrt(Vb^2 - 4*Rp*W)*Vb)/W, Rl == 1/2*(Vb^2 - 2*Rp*W + sqrt(Vb^2 - 4*Rp*W)*Vb)/W]

However for one equation it left a term that it "solved for" on the rhs. Does this mean that the equation can't be solved? Because these are physical, highly predictable systems I find that hard to believe, but I don't see another explanation?


eq72 = solve(1/2*(Vb^2 - 2*Rp*W + sqrt(Vb^2 - 4*Rp*W)*Vb)*pi*r^2/(Rho*W) == W/(F * 2
* pi * r), W)


[W == -(F*Rp*pi^2*r^3 + sqrt(F^2*Rp^2*pi^2*r^4 + F*Rho*Vb^2*r + sqrt(Vb^2 - 4*Rp*W)*F*Rho*Vb*r)*pi*r)/Rho, W == -(F*Rp*pi^2*r^3 - sqrt(F^2*Rp^2*pi^2*r^4 + F*Rho*Vb^2*r + sqrt(Vb^2 - 4*Rp*W)*F*Rho*Vb*r)*pi*r)/Rho]

Which is a symbolic expression that still depends on the "solved for" variable?! Is this behavior a bug? Am I missing something? Is this equation simply lacking a solution?

Thank you for your time

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-15 23:49:55 +0200

tmonteil gravatar image

updated 2017-05-16 09:59:49 +0200

I did not check further, but apparently sympy is able to solve it:

sage: Rl,Rp,W,Vb,Rho,L,r,pi,F = var('Rl,Rp,W,Vb,Rho,L,r,pi,F')
sage: eq = 1/2*(Vb^2 - 2*Rp*W + sqrt(Vb^2 - 4*Rp*W)*Vb)*pi*r^2/(Rho*W) - W/(F * 2 * pi * r)
sage: seq = eq._sympy_() ; seq
pi*r**2*(-2*Rp*W + Vb**2 + Vb*sqrt(-4*Rp*W + Vb**2))/(2*Rho*W) - W/(2*F*pi*r)
sage: import sympy
sage: sympy.solve(seq,W)
[pi*(-2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))/Rho**2,
 -pi*(2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))/Rho**2]

However i am not sure this leads to a correct solution (to be hand-checked):

sage: s = _[0]
sage: seq.subs({W:s})
Rho*r**2*(Vb**2 + Vb*sqrt(Vb**2 - 4*Rp*pi*(-2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))/Rho**2) - 2*Rp*pi*(-2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))/Rho**2)/(2*(-2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))) - (-2*F*Rho*Rp*pi*r**3 + sqrt(2)*Vb*sqrt(F*Rho**3*r**3))/(2*F*Rho**2*r)
sage: seq.subs({W:s}) == 0
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2017-05-15 05:26:33 +0200

Seen: 353 times

Last updated: May 16 '17