I'm working with systems of 10 equations in 14 variables, and for such a system I'd like to know whether any solution exists (complex values are fine). Because the system is under-determined, I expect that much of the time there would be infinitely many solutions that could be given by parameterizing some of the variables. I'm using solve(), and having a lot of success. Often I can get Sage to spit out nice parameterized solutions.

But a lot of the time Sage does one of two things, and I don't understand what they mean:

• spits back out the whole equation, cleaned up a little but not solved in the slightest
• runs forever and never finishes

My question is, do these mean different things about my systems?

Here are a few examples. First define some variables:

a, b, c, d, e, f, g, h, i, j = var('a, b, c, d, e, f, g, h, i, j')
t = var('t', 16)


This one gets solved with solutions involving a few real parameters (no problem there):

eq_a = [t_1 + 1 == 0,
t_11 + t_5 == j,
t_10 + t_12 + t_14 + t_3 + t_6 == 0,
(t_10 + t_3 + t_6)*t_11 + t_3*t_5 == 0,
t_13 + t_2 + t_4 + t_7 + 1 == 0,
(t_1 + 1)*t_13 + t_1*t_2 + t_1*t_4 + t_1*t_7 + t_1 + 1 == 0,
(t_13 + t_2 + t_4 + t_7 + 1)*t_14 + t_10*(t_2 + t_4 + t_7 + 1)
+ t_12*(t_2 + t_4 + t_7 + 1) + t_2*t_3 + (t_2 + t_4)*t_6 == 0,
t_1*t_2*t_3 + (t_1*t_2 + t_1*t_4 + t_1*t_7 + t_1 + 1)*t_10
+ (t_1*t_2 + t_1*t_4 + t_1*t_7 + t_1 + 1)*t_12 + ((t_1 + 1)*t_13
+ t_1*t_2 + t_1*t_4 + t_1*t_7 + t_1 + 1)*t_14
+ (t_1*t_2 + t_1*t_4)*t_6 == 0,
t_2*t_3*t_5 + (t_10*(t_2 + t_4 + t_7 + 1) + t_2*t_3
+ (t_2 + t_4)*t_6)*t_11 == 0,
t_1*t_2*t_3*t_5 + (t_1*t_2*t_3 + (t_1*t_2 + t_1*t_4 + t_1*t_7
+ t_1 + 1)*t_10 + (t_1*t_2 + t_1*t_4)*t_6)*t_11 == d]

solve(eq_a,
t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8,
t_9, t_10, t_11, t_12, t_13, t_14)


This one runs and never finishes:

eq_b = [t_10 + t_4 == a,
(t_10 + t_4)*t_11 + (t_10 + t_4)*t_15 + t_4*t_5 + t_4*t_9 == b,
t_4*t_5*t_6 + t_4*t_5*t_8
+ ((t_10 + t_4)*t_11 + t_4*t_5 + t_4*t_9)*t_12
+ ((t_10 + t_4)*t_11 + t_4*t_5 + t_4*t_9)*t_14 == c,
t_4*t_5*t_6*t_7 + (t_4*t_5*t_6 + t_4*t_5*t_8
+ ((t_10 + t_4)*t_11 + t_4*t_5 + t_4*t_9)*t_12)*t_13 == d,
t_11 + t_15 + t_3 + t_5 + t_9 == e,
(t_11 + t_3 + t_5 + t_9)*t_12
+ (t_11 + t_3 + t_5 + t_9)*t_14
+ (t_3 + t_5)*t_6 + (t_3 + t_5)*t_8 == f,
(t_3 + t_5)*t_6*t_7 + ((t_11 + t_3 + t_5 + t_9)*t_12
+ (t_3 + t_5)*t_6 + (t_3 + t_5)*t_8)*t_13 == g,
t_12 + t_14 + t_2 + t_6 + t_8 == h,
(t_12 + t_2 + t_6 + t_8)*t_13 + (t_2 + t_6)*t_7 == i,
t_1 + t_13 + t_7 == j]

solve(eq_b,
t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8,
t_9, t_10, t_11, t_12, t_13, t_14, t_15)


This one returns a reordered list of the same equations.

eq_c = [t_11 + t_4 == 0,
(t_11 + t_4)*t_12 + t_10*t_4 + t_4*t_5 + t_4*t_8 == a,
((t_11 + t_4)*t_12 + t_10*t_4 + t_4*t_5 + t_4*t_8)*t_13
+ t_4*t_5 + (t_4*t_5 + t_4*t_8)*t_9 == a,
t_4*t_5*t_7 == 0,
t_10 + t_12 + t_3 + t_5 + t_8 == a,
(t_10 + t_12 + t_3 + t_5 + t_8)*t_13
+ (t_3 + t_5 + t_8)*t_9 + t_3 + t_5 == a,
(t_3 + t_5)*t_7 == a,
t_13 + t_2 + t_9 + 1 == a,
(t_2 + 1)*t_7 == a,
t_7 + 1 == a]

solve(eq_c,
t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8,
t_9, t_10, t_11, t_12, t_13, t_14)

edit retag close merge delete

Behavior may depend on the nature of equations - e.g., linear, polynomial, transcendental etc.

( 2022-08-02 19:07:41 +0100 )edit

The equations are polynomials in variables t_1,t_2,etc, and a,b,c,etc. (all defined as symbolic variables). For example, t_1+t_3==a, t_2+t_3(t_4+t_8)==b, etc. I want to solve for the t_i in terms of the a,b,c, etc. I realized a third thing is also happening, which is that it will keep running and look like it is thinking, but then if I interrupt the kernel it will spit out [] indicating no solution. Is there any way for me to interpret these three different results?

( 2022-08-02 20:33:51 +0100 )edit

In general solving systems of polynomial equations is hard - see https://en.wikipedia.org/wiki/System_... So, it's not unexpected that Sage won't be able to some of such systems Anyway, one may have better control over the solving process and gain some speed up via dealing with polynomial (rather than symbolic) variables and ideals.

( 2022-08-02 23:02:05 +0100 )edit

I can try working with polynomials instead and see if that helps! Thanks for considering my question!

( 2022-08-03 19:27:33 +0100 )edit

@kwaddle -- thanks for providing concrete examples. I made some further edits:

• deleted some comments after you included the examples in the question itself (thanks!)
• added code to define the variables, making the examples easier for anyone to reproduce
• renamed the equations eq_a, eq_b, eq_c so it's easier to discuss them separately
( 2022-08-08 13:56:43 +0100 )edit