# solve causing headaches

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)
```

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

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?

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.

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

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

`eq_a`

,`eq_b`

,`eq_c`

so it's easier to discuss them separately