On Wednesday, March 2, 2011 10:04:39 AM UTC-8, sm123123 wrote:
>
> Is there any way to handle scientific precision in base 10 in a simple
> way, using sage ?
>
> Alternatively, are there any libraries that will do something like
> that ?
>
> Using \sage{RIF10(RR10(#1))} in a LaTeX document (#1 is the argument)
> leaves numbers like 6.0421?e-27.
If you do
RIF(...).center()
you get a number without question marks, and then you can print it using
Python's string formatting operations:
<http://docs.python.org/library/stdtypes.html#string-formatting>
For example:
sage: (RIF(0.4) - RIF(4/10)).center()
2.77555756156289e-17
sage: "%g" % (RIF(0.4) - RIF(4/10)).center()
'2.77556e-17'
sage: R = RealIntervalField(10000)
sage: "%g" % (R(0.4) - R(4/10)).center()
'2.22045e-17'
--
John
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org