Updates:
        Status: Started
        Owner: mattpap
        Cc: -mattpap
        Labels: -polys Polynomial Milestone-Release0.7.0

Comment #1 on issue 2087 by mattpap: solver treats a nonlinear expression as linear and mis-solves a true nonlinear system; fixed in polys11 but slow
http://code.google.com/p/sympy/issues/detail?id=2087

In polys11 we get the following results:

In [1]: solve([x + x*y - 3, y + x*y - 4], x, y)
Out[1]: [(-3, -2), (1, 2)]

In [2]: solve_triangulated([x + x*y - 3, y + x*y - 4], x, y)
Out[2]: [(-3, -2), (1, 2)]

In [3]: %timeit u = solve([x + x*y - 3, y + x*y - 4], x, y)
10 loops, best of 3: 24.4 ms per loop

In [4]: %timeit u = solve_triangulated([x + x*y - 3, y + x*y - 4], x, y)
100 loops, best of 3: 8.32 ms per loop

In [5]: F = [-10 + x + y**2, 20 - y + x*y + x**2]

In [6]: %time s = solve(F, x, y)
CPU times: user 0.25 s, sys: 0.00 s, total: 0.25 s
Wall time: 0.26 s

In [8]: F[0].subs(zip((x, y), s[0])).evalf()
Out[8]: 0

In [9]: F[1].subs(zip((x, y), s[0])).evalf()
Out[9]: .0e-126 - .0e-126⋅ⅈ

In [10]: F[0].subs(zip((x, y), s[1])).evalf()
Out[10]: 0

In [11]: F[1].subs(zip((x, y), s[1])).evalf()
Out[11]: .0e-126 + .0e-126⋅ⅈ

The solution 's' is very complicated because quartic root finding algorithm has to be used. There reason for this is the Groebner basis of 'F':

In [12]: groebner(F, x, y)
Out[12]:
⎡           2                  2    3    4⎤
⎣-10 + x + y , 120 + 9⋅y - 20⋅y  - y  + y ⎦

which has a polynomial of degree 4 as the univariate polynomial.

--
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.

Reply via email to