Ask Your Question

Bobesh's profile - activity

2021-07-07 10:20:44 +0100 received badge  Notable Question (source)
2019-12-29 06:31:39 +0100 received badge  Popular Question (source)
2017-12-26 22:03:01 +0100 received badge  Student (source)
2017-12-20 11:26:41 +0100 asked a question 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')
#assumptions
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())

#show(f_S1)

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.