MATLAB: Do I receive different results when running the POLY2SYM function in the Symbolic Math Toolbox 3.1.2 (R14SP2)

complexdoubleiimaginaryjpoly2symrealsubsSymbolic Math Toolbox

I am using the POLY2SYM function with imaginary numbers and the first time I run the function the result is different than subsequent runs. For example, the following code does not convert "i" to sqrt(-1) on the first run, but does when the code is run again:
clear all
poly2sym(i)
poly2sym(i)

Best Answer

This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
There is a bug in the Symbolic Math Toolbox 3.1.2 (R14SP2) in the way that POLY2SYM handles imaginary numbers when MATLAB first starts, or after the "clear all" command is issued.
To work around this issue, enter the following command before calling POLY2SYM for the first time:
sym('i')