# Symbolic solution not fully solved?

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.

E.g.:

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)
eq42


yields:

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

E.g.:

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)


yields:

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

edit retag close merge delete

Sort by » oldest newest most voted

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 = _
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
False

more