Ideally SymPy would be smart enough to split up the equations automatically, so that you can pass them all at once. But someone more familiar with the solvers code would have to verify if that is actually what currently happens. The errors you describe mostly look like bugs (except the solveset one, which I think is just it telling you that solveset doesn't support systems of equations yet). So it would be useful to have an example that reproduces them.
Aaron Meurer On Wed, Jan 6, 2021 at 10:20 AM Thomas Ligon <[email protected]> wrote: > > I am trying to solve some algebraic (polynomial) equations. In the first > approximation, I have 4 equations in 4 variables, and it is very easy to > solve them manually. In the second approximation, I have 8 equations in 8 > variables, and I am trying to solve them. At the beginning, the equations are > linear or quadratic in the variables. After solving one equation for one > variable and substituting the result into the other equations, the complexity > grows very fast. > One very naive attempt I made was to give all 8 equations and 8 variables to > solve. That has been running for over 3 weeks and I don't know if it will > succeed. > Then I started using solveset and solving the equations one by one. After one > call to nonlinsolve and one substitution, I tried giving this expression > (Latex form) > 2 \(-1\) b_{-1} \left( - \frac{\(1\) b_{-1}^{2} + 2 \(1\) b_{-2} + \[1,-1\] > b_{-1} b_{-2} + \[1\]}{\[1,2\] b_{2} + 2 \[1\] b_{-1} - 1}\right) + \(-1\) + > \[-1,-2\] b_{-1} b_{-2} + \[-1,1\] b_{2} \left( - \frac{\(1\) b_{-1}^{2} + 2 > \(1\) b_{-2} + \[1,-1\] b_{-1} b_{-2} + \[1\]}{\[1,2\] b_{2} + 2 \[1\] b_{-1} > - 1}\right) + \[-1\] b_{-1}^{2} + 2 \[-1\] b_{-2} - b_{-1} > to solveset as > solbm1 = solveset([exbm1], [bm1]) > and I got the error > [2b_{-1}b_{-1}2 + 2*(1)*b_{-2} + [1,-1]*b_{-1}*b_{-2} + [1])/([1,2]*b_2 + > 2*[1]*b_{-1} - 1),) + (-1) + [-1,-2]*b_{-1}*b_{-2} + > [-1,1]*b_2*(-((1)*b_{-1}2 + 2b_{-2} + [1,-1]b_{-2} + [1])/([1,2][1]b_{-1}**2 > + 2b_{-2} - b_{-1}] is not a valid SymPy expression > When I use nonlinsolve instead, I get the error > 'Tuple' object has no attribute '_eval_is_polynomial' > When I use solve instead, I get the error > Can't multiply sequence by non-integer of type '<class 'sympy.core.mul.Mul'>' > The complex expression came from solving one equation and using subs to put > the result into a second equation. If it helps, I could try calling expand > before trying to solve the resulting equation. > Basically, I am looking for advice about the best strategy for solving > multiple polynomial equations. Is it better to try to solve them all at once, > or one equation at a time (but with multiply substitutions and multiple calls > to solve/solveset/nonlinsol), or all equations but one variable at a time? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/137d76ed-8168-4ecf-9fb9-c5c2a14b66a5n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Kvh3SQc8DFLAwJKmuhSJR%3DA4n6REDSSBmC%2B%2BnQpn1MQw%40mail.gmail.com.
