How to solve polynomial equation system

asked 2016-02-09 02:08:24 -0500

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 11:05:01 -0500 )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 16:18:38 -0500 )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 03:48:32 -0500 )edit

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

kcrisman gravatar imagekcrisman ( 2016-02-11 09:36:58 -0500 )edit

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

Dan gravatar imageDan ( 2016-02-11 12:21:36 -0500 )edit