Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

Sage is based on Python. This error comes from numpy.var function (variance calculation on numeric array) like numpy.var([1,2,3]) = 0.6666666666663. I had the same problem because I use a pythonrc.py file which import all from numpy (from numpy import *) each time I start a python console. Commenting this import will solve the problem and Sage will recognize the var function (which comes from sympy.var, var as variable not variance).

So in Sage : x=var('x') won't produce any error and it works fine.

Another solution is to "import numpy as np" or simply "import numpy" to make sure we don't overwrite "variable" with "variance".

;)

Hi,

Sage is based on Python. This error comes from numpy.var function (variance calculation on numeric array) like numpy.var([1,2,3]) = 0.6666666666663. I had the same problem because I use a pythonrc.py file which import all from numpy (from numpy import *) each time I start a python console. Commenting this import will solve the problem and Sage will recognize the var function (which comes from sympy.var, var as variable not variance).

So in Sage : x=var('x') won't produce any error and it works fine.

Another solution is to "import numpy as np" or simply "import numpy" to make sure we don't overwrite "variable" with "variance".

;)

bigduke