J
jerry.carl.mi
Hi,
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats... herefore exp(sin(Decimal())) produces exp
() of a float :-(
So far, i found:
-AJDecimalMathAdditions (http://www.ajgs.com/programming/
PythonForDownload.html)
-decimalfuncs (http://pypi.python.org/pypi/decimalfuncs/1.4)
-and dmath (http://pypi.python.org/pypi/dmath/0.9)
I tried using the AJDecimalMathAdditions, but ran into issues like dSin
(1E4) would take forever to calculate and would result in sin() >
1 ... If i understand it correctly, the program is using maclaurin
series to calculate the value and since it does not chop off all the
multiples of 2*pi, the maclaurin approximation becomes useless when
its too far from x=0.
I also ran into some issues with the decimalfuncs, but i have never
tried the dmath thing.
Now, i can go and start modifying these modules to behave more like
the standard math module but since i am neither mathematician or
programer, i really hesitate.
So my questions are:
(1) what do folks use when they need to calculate something like exp
(sin(Decimal())) or even more complex things? Any recommendations? Or
am I completely missing something?
(2) Is there any plan to provide a standard python module that would
do that? (Python 4.0? ;-)
Thanks for your comments and help,
Jerry
I have been looking for a Python module with math functions that would
both eat and spit Decimals. The standard math module eats Decimals
allright but spits floats... herefore exp(sin(Decimal())) produces exp
() of a float :-(
So far, i found:
-AJDecimalMathAdditions (http://www.ajgs.com/programming/
PythonForDownload.html)
-decimalfuncs (http://pypi.python.org/pypi/decimalfuncs/1.4)
-and dmath (http://pypi.python.org/pypi/dmath/0.9)
I tried using the AJDecimalMathAdditions, but ran into issues like dSin
(1E4) would take forever to calculate and would result in sin() >
1 ... If i understand it correctly, the program is using maclaurin
series to calculate the value and since it does not chop off all the
multiples of 2*pi, the maclaurin approximation becomes useless when
its too far from x=0.
I also ran into some issues with the decimalfuncs, but i have never
tried the dmath thing.
Now, i can go and start modifying these modules to behave more like
the standard math module but since i am neither mathematician or
programer, i really hesitate.
So my questions are:
(1) what do folks use when they need to calculate something like exp
(sin(Decimal())) or even more complex things? Any recommendations? Or
am I completely missing something?
(2) Is there any plan to provide a standard python module that would
do that? (Python 4.0? ;-)
Thanks for your comments and help,
Jerry