Bug introduced in 9.0 and fixed in 11.0.0

Three-argument form of CoefficientList is documented since 10.3 only.

The Kernel of my Mathematica 10.4 seems to crash on certain use of the CoefficientList command. The line

CoefficientList[x + y^2, {x, y}]

produces the matrix

$$ \begin{pmatrix} 0 & 0 & 1\\ 1 & 0 & 0 \end{pmatrix} $$

as it should. However, when I try to extract the $2\times 2$ upper left submatrix by evaluating the following command, I get an instant crash:

CoefficientList[x + y^2, {x, y}, {2, 2}]

The strange thing is that this only happens in some occasions. For instance,

CoefficientList[x^2 + y, {x, y}, {2, 2}]

works just fine. Is there anyway around this problem (which I assume to be a bug) that does not decrease the speed of the operation? I'm working with high degree polynomials in two variables from which I need to extract the $100\times 100$ coefficient matrix as fast as possible.

  • 1
    $\begingroup$ Interestingly enough, this crashes my version of Mathematica---v10.0---and the third argument to CoefficientList was introduced in v10.3! But it seems that this is an undocumented feature in v10.0, because your second one (that doesn't crash) works for me, too. Weird. $\endgroup$ – march Apr 13 '16 at 22:21
  • 1
    $\begingroup$ Might be able to use CoefficientArrays as a workaround. $\endgroup$ – Daniel Lichtblau Apr 13 '16 at 22:36
  • 2
    $\begingroup$ We do not add the bugs tag to a question until your observations have been confirmed by other users. Nevertheless, I can also confirm this crash on 10.3, so I'll let you off this time. $\endgroup$ – J. M.'s technical difficulties Apr 14 '16 at 0:13
  • $\begingroup$ More interestingly, CoefficientList[x^2 + y^3, {x, y}, {2, 2}] // MatrixForm crashes half of the time. When you first run it, it gives {{0, 0}, {0, 0}}. When you run it the second time, Mathematica crashes. CoefficientList[x^2 + y^3, {x, y}, {2, 2}], without MatrixForm crashes always. $\endgroup$ – JungHwan Min Apr 14 '16 at 3:58
  • $\begingroup$ This happens occasionally. This could be reproduced by running the code fresh on a new notebook after closing Mathematica completely. $\endgroup$ – JungHwan Min Apr 14 '16 at 4:18

This bug has been fixed as of Mathematica 11.0.0.

CoefficientList[x + y^2, {x, y}, {2, 2}]

(* {{0, 0}, {1, 0}} *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.