Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New 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
We need a means to calculate the constant coefficient of a polynomial.
Currently f.coeff(1) always returns nothing, which makes no sense:
In [1]: sympy.var('a b c d x')
Out[1]: (a, b, c, d, x)
In [2]: f = a*x**2 + b*x + c
In [3]: f.coeff(x**2)
Out[3]: a
In [4]: f.coeff(x)
Out[4]: b
In [5]: f.coeff(1)
There is no way of telling the method to which variable the polynomial is
referrering, so of course it can't calculate the constant coefficient.
The ugly workaround currently is:
In [6]: cons = f - x**2*f.coeff(x**2) - x*f.coeff(x); cons
Out[6]: c
--
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
-~----------~----~----~----~------~----~------~--~---