ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 26 Mar 2022 00:21:58 +0100Finding coefficients of complex polynomialshttps://ask.sagemath.org/question/61626/finding-coefficients-of-complex-polynomials/Hello,
I've found that the function `coefficients()` behaves differently when the coefficients of a polynomial are complex instead of real. For example:
sage: R.<x, y> = PolynomialRing(ZZ[I], 2)
sage: F = 2*I*x*y + 3*x^2*y^3
sage: F.coefficients()
[[2*I*y, 1], [3*y^3, 2]]
sage: G = 2*x*y + 3*x^2*y^3
sage: G.coefficients()
[3, 2]
Also a similar thing happens with univariate polynomials over `CC`.
sage: S.<z> = PolynomialRing(CC)
sage: f = z^2 + z + I
sage: f.coefficients()
[[1.00000000000000*I, 0], [1.00000000000000, 1], [1.00000000000000, 2]]
sage: g = z^2 + z + 1
sage: g.coefficients()
[1.00000000000000, 1.00000000000000, 1.00000000000000]
Why is there this difference? How can I find a list of the coefficients like when the polynomials are purely real? This is in SageMath version 8.1, is it maybe the issue that this version is outdated?Sat, 26 Mar 2022 00:04:25 +0100https://ask.sagemath.org/question/61626/finding-coefficients-of-complex-polynomials/Answer by FKalker for <p>Hello, </p>
<p>I've found that the function <code>coefficients()</code> behaves differently when the coefficients of a polynomial are complex instead of real. For example:</p>
<pre><code>sage: R.<x, y> = PolynomialRing(ZZ[I], 2)
sage: F = 2*I*x*y + 3*x^2*y^3
sage: F.coefficients()
[[2*I*y, 1], [3*y^3, 2]]
sage: G = 2*x*y + 3*x^2*y^3
sage: G.coefficients()
[3, 2]
</code></pre>
<p>Also a similar thing happens with univariate polynomials over <code>CC</code>.</p>
<pre><code>sage: S.<z> = PolynomialRing(CC)
sage: f = z^2 + z + I
sage: f.coefficients()
[[1.00000000000000*I, 0], [1.00000000000000, 1], [1.00000000000000, 2]]
sage: g = z^2 + z + 1
sage: g.coefficients()
[1.00000000000000, 1.00000000000000, 1.00000000000000]
</code></pre>
<p>Why is there this difference? How can I find a list of the coefficients like when the polynomials are purely real? This is in SageMath version 8.1, is it maybe the issue that this version is outdated?</p>
https://ask.sagemath.org/question/61626/finding-coefficients-of-complex-polynomials/?answer=61627#post-id-61627It is indeed the case that my sagemath version is outdatedSat, 26 Mar 2022 00:21:58 +0100https://ask.sagemath.org/question/61626/finding-coefficients-of-complex-polynomials/?answer=61627#post-id-61627