Post Reply 
HP35s Revisited Trig Quandary Bug # 2
02-17-2015, 06:00 PM
Post: #14
RE: HP35s Revisited Trig Quandary Bug # 2
(02-17-2015 05:41 PM)Thomas Klemm Wrote:  
(02-16-2015 11:53 PM)MarkHaysHarris777 Wrote:  So, here is COS(89.9999) calculated to 500 digits:

Any reason for not using mpmath?

>>> from mpmath import *
>>> mp.dps = 500; mp.pretty = True
>>> arg = mpf('89.9999')
>>> cos(arg*degree)
0.000001745329251993443480767989605432786337627037312316176388873390931431554460​41360462904334365249335531055809287604438274442522096084140764859073443378471194​48948828512712058055726413331807627260020175652982884954161960424446318969977141​75132577300742842685207613919951602005662147690953427519610453528493822291308882​39017050032565967537592386621092663154955614255895040086322506359476098786735809​82632745296514824299930490272874039749943660184410685301981172847714229781608738​522219431997542244860816323

Your answer is wrong-- again, I'm shocked. The last five digits are not correct; should be
... 448, 608, 060, 010, 428, 3...

mpmath is a fabulous package (depending on what else is installed with it (gmpy, sage) but the main problem with it (for my purposes) is speed. mpmath uses Python's long integers by default (not the new Decimal module). Consequently, its too slow for calculating millions of digits of PI, or multiple transcendentals of hundreds of thousands of digits (not that many people except geeks like me do that, I get it). its been a while since I looked into mpmath as a package; my interest was the new C implementation of the Decimal module for Python 3.2+ because it is incredibly fast! I'm using Python 3.4 now, and the Decimal module there screams. Just say'n. Having said all of that, I must admit that I have not run mpmath with gmpy, nor sage. So, I don't have a fair comparison.

Cheers,
marcus
Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP35s Revisited Trig Quandary Bug # 2 - MarkHaysHarris777 - 02-17-2015 06:00 PM



User(s) browsing this thread: 1 Guest(s)