How to solve polynomial equation system

asked 2016-02-09 09:08:24 +0100

Dan gravatar image


I'm pretty new to Sage and excited in discovering new functions and ways to solve certain problems. Previously I've been massively working with sympy for solving equation systems. However I wanted to try out Sage.

Currently I'm facing a polynomial equation system (3x3 with three unknown variables a,b,d) where the polynom is of degree 2. However the equations include also trigonometric elements such as cos(a), sin(b) etc.

How can polynomial equations with trigonometric elements be solved in sage? (under the condition that the specific equation system is solvable at all). Is there a specific solver which is recommended to use for such type of equations?

Thank you in advance for any hints and with best regards


edit retag flag offensive close merge delete


You may want to use the to_poly_solve=True option for solve(), which uses Maxima under the hood.

kcrisman gravatar imagekcrisman ( 2016-02-09 18:05:01 +0100 )edit

Could you please give us a concrete example ? Sage symbolic capabilities are not uniform, so it really depends on the kind of expressions.

tmonteil gravatar imagetmonteil ( 2016-02-09 23:18:38 +0100 )edit

@kcrisman: thank you for your hint on to_poly_solve=True :)

@tmonteil: certainly!

var('delta alpha_orig alpha_v')

par1 = (delta*sin(alpha_orig) + 0)**2*sin(alpha_v)/cos(alpha_v)**2 == delta*cos(alpha_orig) + 0
par2 = (delta*sin(alpha_orig) + 2)**2*sin(alpha_v)/cos(alpha_v)**2 == delta*cos(alpha_orig) + 4
par3 = (delta*sin(alpha_orig) - 2)**2*sin(alpha_v)/cos(alpha_v)**2 == delta*cos(alpha_orig) + 4

solve([par1,par2,par3],delta, alpha_v, alpha_orig, to_poly_solve='force')

for x and y any points can be inserted. So I thought of setting up a 3x3 equation system and trying to solve a,b and d.

However doing this with plain 'solve' makes sage to run for a very long time (actually it stopped only when it ran out of memory).

Thank you in advance for any hints and with best regards Dan

Dan gravatar imageDan ( 2016-02-10 10:48:32 +0100 )edit

Some of these are probably arbitrarily (computationally) hard, keep in mind.

kcrisman gravatar imagekcrisman ( 2016-02-11 16:36:58 +0100 )edit

Is there a specific way to check if they are computationally hard?

Dan gravatar imageDan ( 2016-02-11 19:21:36 +0100 )edit