Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TypeError using plot3d

Hi,

this is my first time using Sage, so this might be a very trivial question for which, however, I could not find an answer:

I would like to produce a 3d plot of a complicated function, the part where it fails seems to be:

T = RealDistribution('gaussian',1) plot3d(T.cum_distribution_function((1-y)/x), (x,-2,2), (y,-2,2))

where I get the following error message:

sage: plot3d(T.cum_distribution_function((1-y)/x), (x,-2,2), (y,-2,2))

TypeError Traceback (most recent call last) <ipython-input-37-db1aa10c790f> in <module>() ----> 1 plot3d(T.cum_distribution_function((Integer(1)-y)/x), (x,-Integer(2),Integer(2)), (y,-Integer(2),Integer(2)))

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/gsl/probability_distribution.so in sage.gsl.probability_distribution.RealDistribution.cum_distribution_function (sage/gsl/probability_distribution.c:6127)()

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__float__ (sage/symbolic/expression.cpp:7716)()

TypeError: unable to simplify to float approximation

Where does this error come from and how can I plot the function?

Thanks in advance

click to hide/show revision 2
No.2 Revision

TypeError using plot3d

Hi,

this is my first time using Sage, so this might be a very trivial question for which, however, I could not find an answer:

I would like to produce a 3d plot of a complicated function, the part where it fails seems to be:

T = RealDistribution('gaussian',1)
plot3d(T.cum_distribution_function((1-y)/x), (x,-2,2), (y,-2,2))

(y,-2,2))

where I get the following error message:

   sage: plot3d(T.cum_distribution_function((1-y)/x), (x,-2,2), (y,-2,2))

(y,-2,2)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-37-db1aa10c790f> in <module>() ----> 1 plot3d(T.cum_distribution_function((Integer(1)-y)/x), (x,-Integer(2),Integer(2)), (y,-Integer(2),Integer(2)))

(y,-Integer(2),Integer(2)))

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/gsl/probability_distribution.so in sage.gsl.probability_distribution.RealDistribution.cum_distribution_function (sage/gsl/probability_distribution.c:6127)()

(sage/gsl/probability_distribution.c:6127)()

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.__float__ (sage/symbolic/expression.cpp:7716)()

(sage/symbolic/expression.cpp:7716)()

TypeError: unable to simplify to float approximation

approximation

Where does this error come from and how can I plot the function?

Thanks in advance