Status: Accepted
Owner: [email protected]
Labels: Type-Defect Priority-Medium

New issue 2343 by [email protected]: as_poly returns None
http://code.google.com/p/sympy/issues/detail?id=2343

Here is an expression in x and y
    h[1] >>> q1
    -1 + (1/2 - x/2)**2 + (1/3 - y/3)**2
    h[2] >>> _.as_poly(x,y)

It didn't become a poly. Let's sympify the string form and try again:
    h[2] >>> S(str(q1)).as_poly(x,y)
    Poly(1/4*x**2 - 1/2*x + 1/9*y**2 - 2/9*y - 23/36, x, y, domain='QQ')

It worked!? Try expanding q1 and trying
    h[3] >>> q1.expand()
    -23/36 - 2*y/9 - x/2 + x**2/4 + y**2/9
    h[4] >>> _.as_poly(x,y)

It failed...is it the denominator issue?
    h[4] >>> q1.expand()*36
    -23 - 18*x - 8*y + 4*y**2 + 9*x**2
    h[5] >>> _.as_poly(x,y)

No, that fails, too.

solve_polys_system fails because of this failure to create a poly from such expressions. e.g.

    h[1] >>> e1=Ellipse((1,1),2,3)
    h[1] >>> e2=Ellipse((2,3),1,4)
    h[1] >>> q1=e1.equation()
    h[1] >>> q2=e2.equation()
    h[1] >>> solve([q1,q2],[x,y])

    this is the print put in the area of failure showing the 'g' for
    which a conversion to poly was attempted at line 364 in solvers.py
    g                                    symbols g.has(s) for s in symbols
    ------------------------------------  ------  -----------------------
    -1 + (1/2 - x/2)**2 + (1/3 - y/3)**2, [x, y],   [True, True]

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "sympy\solvers\solvers.py", line 371, in solve
        raise NotImplementedError()
    NotImplementedError

What is the solution to this problem?

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