2

While using sympy (current version) to solve an polynomial equation (polynom would be d² in this case):

from sympy import solve_poly_system
solve_poly_system(4*d**2*sin(a)**2*sin(b)/cos(b)**2 - d*cos(a) + 4, d**2*sin(a)**2*sin(b)/cos(b)**2 - d*cos(a) + 8, 3*d**2*sin(a)**2*sin(b)/cos(b)**2 - d*cos(a) + 3 ,d ,a, b)

I receive the following error:

PolynomialError: cos(a) contains an element of the generators set

What is the exact meaning of this error message. And why does it specifically points to the expression cos(a)?

Cleb
  • 25,102
  • 20
  • 116
  • 151
Daniyal
  • 885
  • 3
  • 16
  • 28
  • Could you show how you created a, b and d?! – Cleb Feb 08 '16 at 13:30
  • Oh, my apologies, I missed to provide that information, of course: a, b, d = symbols("a, b, d") PS: Thank you Cleb for editing the original message! :) – Daniyal Feb 09 '16 at 08:13

1 Answers1

2

solve_poly_system can only solve polynomial systems of equations. Since your equations have cos(a), they are not polynomials in a.

asmeurer
  • 86,894
  • 26
  • 169
  • 240
  • good point! I've looked in the documentation, yet without any success. Is there any solver in sympy which enables the computation of equation systems which have trigonometric elements, such as in the given example? – Daniyal Feb 11 '16 at 09:30
  • I tried solving your system, even by first replacing the sines and cosines by variables (and adding equations for `sin(a)**2 + cos(a)**2 = 1`), and it couldn't solve it. How sure are you that there is a closed-form answer in this case? – asmeurer Feb 11 '16 at 15:46
  • That is a valid aspect which I haven't checked yet. For polynomial equations I know that Galois theory provides a theorem in order to check if a closed form solution exists. But for trigonom. equations I haven't found yet any way to check if there is a closed-form answer. Do you know any paper or keyword for checking on trigonom. equations if a closed form exists? – Daniyal Feb 11 '16 at 18:19
  • If you could solve the system of polynomials in terms of d, cos(a), cos(b), sin(a), sin(b) you could invert the solutions for the cosine and sine variables using asin and acos. The issue here is that SymPy's solve failed when I tried this because the system is not zero dimensional (meaning either an additional equation is needed or the solution is parameterized, which at any rate SymPy doesn't support). – asmeurer Feb 11 '16 at 19:41