Hi,

On 23 October 2010 10:22, Chenjie Gu <[email protected]> wrote:

> Thanks a lot for the reply. I'll read the match algorithm later.
>
> But for the script you gave, it seems that in my version of sympy, there's
> no function called "as_Add()".
> I am using sympy 0.6.7. Are you using a higher version of sympy?
>

If there is no as_Add() (possibly it was added after last release), then
use:

In [1]: make_list(1 + x, Add)
Out[1]: [1, x]


>
> Chenjie
>
>
> On Sat, Oct 23, 2010 at 1:06 AM, smichr <[email protected]> wrote:
>
>> ...and if you only want terms that acutally have x then also use the
>> method .has():
>>
>>
>> h[1] >>> [a for a in (1+x).as_Add() if a.is_polynomial(x)]
>> [1, x]
>> h[2] >>> [a for a in (1+x).as_Add() if a.has(x) and
>> a.is_polynomial(x)]
>> [x]
>> h[3] >>>
>>
>>
>>
>>
>>
>>
>> /c
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected] <sympy%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <sympy%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

Mateusz

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to