Yeah, that looks like a wrong result to me. It's because it's using
as_independent(x), but it should only do that if it's an Add. I think
it should be an easy fix if you want to give it a shot.

Aaron Meurer

On Mon, Mar 24, 2014 at 7:07 AM, Abdul-Azeez Isiaq <[email protected]> wrote:
> I am quite new to python and am using the sympy library to work on some
> mathematical code using the parser input. The problem is that it parses the
> coefficient of x as the constant when there is no constant in the
> expression. Below is a simple example of what am trying to explain.
>>>> parse_expr("2x", transformations=transformations)
> 2x
>>>> eqn= parse_expr("2x", transformations=transformations)
>>>> eqn.coeff('x',0)
> 2
>>>> eqn.coeff('x')
> 2
> ]
>  At least am very sure eqn.coeff('x',0) which is a constant is eqn  to 0  in
> this equation but the compiler says it is 2.
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/16ac5b41-fb76-494d-b407-5f1087447c4a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BvjhE4L4aNfpctPCKjJfrNELUEuT0pZo8ZCikn%3DOKBkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to