Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Converting my previous comment to an answer.

This is IMNSHO a bug, reported as Trac#28814.

The conversion is incorrect in the Sage --> Mathematica direction:

sage: 0.000001._mathematica_()
-7 + 10.*e
sage: QQ(0.000001)._mathematica_()
1/1000000

A workaround is to cast those inconvenient floating point quantities to rational approximations:

sage: mathematica.N(mathematica.Sin(0.000001)).sage()
-1.0*sin(-10.0*e + 7.0)
sage: mathematica.N(mathematica.Sin(QQ(0.000001))).sage()
9.999999999998333e-07

[ Note : In general, avoiding floats in the solution of mathematical problems is IMNSHO good heuristics, if not necessarily good numerical analysis... ]

Converting my previous comment to an answer.

This is IMNSHO a bug, reported as Trac#28814.

The conversion is incorrect in the Sage --> Mathematica direction:

sage: 0.000001._mathematica_()
-7 + 10.*e

But doesn't affect rationals:

sage: QQ(0.000001)._mathematica_()
1/1000000

A workaround is to cast those inconvenient floating point quantities to rational approximations:

sage: mathematica.N(mathematica.Sin(0.000001)).sage()
-1.0*sin(-10.0*e + 7.0)
sage: mathematica.N(mathematica.Sin(QQ(0.000001))).sage()
9.999999999998333e-07

[ Note : In general, avoiding floats in the solution of mathematical problems is IMNSHO good heuristics, if not necessarily good numerical analysis... ]