Sympy coeff not consistent with as_independent
<p>I have the following snippet of code</p>

<pre><code>import sympy

a = sympy.symbols('a')
b = sympy.symbols('b')
c = sympy.symbols('c')

print((a*b).coeff(c,0))
print((a*b).as_independent(c)[0])
</code></pre>

<p>I don't understand why the two print statements print different output. According to the documentation of coeff:</p>

<pre><code>You can select terms independent of x by making n=0; in this case
expr.as_independent(x)[0] is returned (and 0 will be returned instead
of None):

&gt;&gt;&gt; (3 + 2*x + 4*x**2).coeff(x, 0)
3
</code></pre>

<p>Is this a bug in sympy, or do I miss something?</p>

<p>It's a bug. I have a pull request fixing it <a href="https://github.com/sympy/sympy/pull/11590" rel="nofollow">here</a>. </p>

python sympy