Updates:
Status: Accepted
Labels: Solvers Simplify
Comment #1 on issue 2015 by asmeurer: Hangs attempting to solve a system of
linear equations
http://code.google.com/p/sympy/issues/detail?id=2015
I couldn't get the pickling to work (ValueError: invalid digits), but that
doesn't really matter, because I was able to enter the equations manually
and saw the same issue, even in the git master.
The problem comes from simplifying the solutions (specifically, slow
expand() and probably also slow highly multivariate Poly b.c. of DMP
representation in master). For example, if you do:
M = Matrix([[0, 1, -1/d,
0, 0, 0, 0,
-r/d],
[0, 0, (d*e + d*g + e*g)/(d*e*g),
-1/g, 0, 0, 0,
r/d],
[0, 0, -1/g, (g*i + g*j +
i*j)/(g*i*j), -1/i,
0, 0, 0],
[0, 0, 0, -1/i, (i*l + i*m +
l*m)/(i*l*m), -1/m, 0, 0],
[0, 0, 0,
0, -1/m, (m*o + m*p + o*p)/(m*o*p), -1/p,
0],
[0, 0, 0,
0, 0, -1/p, (p + q)/(p*q),
0]])
M.rref(simplified=True)
You'll get a solution right away (in Matrix form), but if you then call
A.applyfunc(cancel) (or Poly.cancel or simplify in sympy 0.6.7) on the
first element of the result, it will hang. If you don't care about this,
then perhaps this workaround will do.
Also, you could try another solution that was suggested recently on the
mailing list, which is to replace the symbolic coefficients with dummy
symbols (see
http://groups.google.com/group/sympy/browse_thread/thread/44d030bb5476b8e).
You only have to be careful that each dummy symbol does not depend on the
others, basically because the rref algorithm correctness requires the
ability to determine if an expression is identically 0. In this specific
case, you can also make things a little simpler by applying .subs({1/d:d,
1/e:e, 1/g:g, 1/i:i, 1/j:j, 1/l:l, 1/m:m, 1/o:o, 1/p:p, 1/q:q}) to each
equation, and then again when you are done.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.