Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Setting Precision in Sage

integral(integral(e^(-0.00260657639223762*(h - 11.1600000000000)^2 - 1.34372480515*(d - 2.85000000000000)^2)/pi, d, 0,Infinity), h, 0, Infinity).n()

I have been working through an error I am receiving with the above command. The error I get when I run it is:

TypeError: Error executing code in Maxima
    sage297 : integrate(sage293,sage294,sage295,sage296)$
Maxima ERROR:

rat: replaced -0.0026065763922 by -200/76729 = -.00260657639223762

rat: replaced -11.16 by -279/25 = -11.16

rat: replaced -1.343724 by -3233/2406 = -1.34372402327515

rat: replaced -2.85 by -57/20 = -2.85
Maxima encountered a Lisp error:

 5883790627 is not of type FIXNUM.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

However if I shorten the decimals to something like:

integral(integral(e^(-0.0026*(h - 11.1600000000000)^2 - 1.343724*(d - 2.85)^2)/pi, d, 0,Infinity), h, 0, Infinity).n()

Then the command runs fine without any issues. Now perhaps this is a bug, but really I do not need the level of precision that is in these commands. Of course I do not want numbers here but variables and it is evaluating the variables to this level of precision that is causing the issue. For example I say:

sage: f(d,h) = (1/(2*pi*0.61*13.85))*exp(-1/2*((d-2.85)^2/0.61^2+(h-13.85)^2/13.85^2))
sage: f
(h, d) |--> 0.05918210333195241758892111025625850742735*e^(-0.002606576392237615503916381029337017294634*(h - 11.16000000000000000000000000000000000000)^2 - 1.343724805159903251814028486965869389949*(d - 2.850000000000000000000000000000000000000)^2)/pi

Any ideas? P.S. I have searched around, but I have not found any that apply to just basic numbers in Sage.