Comment #4 on issue 1312 by danielstefanmader: provide a way to calculate  
the constant coefficient of a polynomial
http://code.google.com/p/sympy/issues/detail?id=1312

Thank you for the quick reply!

Yet, it still doesn't work for me, maybe because the [S(1)] statement  
returns an error:

In [1]: import sympy

In [2]: sympy.var('a b c x')
Out[2]: (a, b, c, x)

In [3]: f = a*x**2 + b*x + c

In [4]: sol=sympy.collect(f,x,evaluate=False)

In [5]: sol[x**2]
Out[5]: a

In [6]: sol[x]
Out[6]: b

In [7]: sol[1]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)

/home/mader/<ipython console> in <module>()

KeyError: 1

In [8]: sol[0]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)

/home/mader/<ipython console> in <module>()

KeyError: 0

In [9]: sol=sympy.collect(f,x,evaluate=False)[S(1)]
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/mader/<ipython console> in <module>()

NameError: name 'S' is not defined

Any help or hint is deeply appreciated!



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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