Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage solve returns empty list

I have very complex formula, and I have to solve that formula for one of variables (get some variable from expression). If I use solve() function is sage, it returns empty list, which is odd, but I found that it could be caused by too complex expression. So I managed to use sympy.solve(), but it returns exception. Here is part of my code:

 k, u, v ,w , E, B, S, J, C1, C2 = var('k', 'u', 'v', 'w', 'E', 'B', 'S', 'J', 'C1', 'C2')
assume(B > 0)
assume(S > 0)
assume(J > 0)
assume(k > 0)
assume((u*E^2 + v*E + w) > 0)

f1 = (S == 1/6*(4*E^3*u + 3*E^2*v)/B + 1/6*(2*E^3*u + 3*E^2*v + 6*E*w)/B - k)
f2 = (J == E/B - k/(E^2*u + E*v + w))

#solve f1 and f2 for E

E_S = solve(f1, E)
E_J = solve(f2, E)

#under our assumptions only E_S[2] and A_J[2] are real
#so for that solutions lets find S

f_S1 = (E_S[2].right() == E_J[2].right())


solve(f_S1, S) #returns []

import sympy
sympy.solve(f_S1, S) #returns exception

I tried to rewrite to sympy in spyder as well, but computations didint finish in two days so I canceled it.