4

The CASIO fx-7400G calculator is very quick at doing $(1+1/1000000)^{1000000}$, giving an output of $2.718280469$.

Mathematica (v7) takes over a minute, running on an Intel Core2 Duo processor, and its output is this:

alt text

With $n=10000000$, my patience ran out. The calculator is quick again with an output of $2.718281693$.

Does anybody know why this happens?

user061703
  • 3,877
Weltschmerz
  • 6,875

3 Answers3

7

Try

N[1 + 1/100000000000000, 2000]^100000000000000

which makes Mma do the computation with floating point numbers (but using 2000 exact digits, waaaaay more that your calculator!) In my computer,

In[41]:= Timing[N[1 + 1/100000000000000, 2000]^100000000000000]

Out[41]= {0.001999, 
2.71828182845903164395114517625107361345759538109318401368108700081263
8880450911203511655259489457817904923933478503365902065203002443715271
2825230612837327582882359132201752486932090411441742152459981748434424
6796125955942676709724311384945123182525138185474706841748184641523835
6399319640050121555981826495805200410019220302352025402844917823115708
4890277526840712036588689004850449217720498524694546241483265385120337
3036215908323704165098770345249059641531345794163630084215403881301114
0222776646139077637586730556318554208747513123989912904288599990729397
4105912301684777926066523131379164170616992617301710309080427339172694
8652209704120914116266089477162936814414049552884109177338585344418934
4664761359706737137907335308204793693031274512475102742160130609557028
0606249997104370287581131479088448270923696582800846475772654584603126
9574917252623375481387197279590503661010907784866738170370137382154502
5239391867955746777742097465819430570361920416259681558416618161699424
5237267230224583604177051168028000345047412788448526660107314695031108
5918243291907671190858585383905903649083888525646705126721235172922992
7474539583108858881111281802649615453982269311194004892438663488977893
2481678450112257387961011092938028584251024526367562391996230685117325
0436239706780584781622006285082275199325910403142256578320132681839729
1241283875634170613592405031777334496908146321259758762276254422018659
2501711558155518458153097538288499261588998555672920722850605105301158
3203321297849315979775985916474141976627081937753054953188751346134290
6581791976723248211158139510858187401773833843382750617470712252506403
3501718283248275223376526908879174360214195321187111170739858908536480
0084276450965142494861141929264441784847261049017482036450996057648280
0994695573343998546256052750841029336112669690421548936514156835398676
3390097789579643086512481978170502348966487726085752931492687574582562
2555386293362518511636564659786083245494967887013590756572099854766124
625831647757374695456737571}

takes 0.002 seconds.

6

General purpose computer algebra systems, unlike most calculators, are able to perform both exact/symbolic computations (e.g. exact integer arithmetic) in addition to approximate numerical computations (e.g. floating point). Thus when you present the problem in exact terms - as you do above - they will preserve that form - so as not to lose any information. Thus your problem will be interpreted as a computation in exact rational arithmetic, i.e. raising a rational number to an integer power. If instead you desire a real approximation of the result then you must explicitly specify such, e.g. using N[...] in Mma. This is but one of the many complexities that arise when one passes from special-purpose computation systems (e.g. calculators) to general purpose computer algebra systems (speaking as one who has often tried to tackle less trivial such complexities while working as a developer of the Macsyma computer algebra system).

Bill Dubuque
  • 272,048
2

I think your calculator might use $$ a^b = \exp(b\ln a)$$ together with precalculated $\exp$ and $\ln$ tables to speed things up.

I know I would =)

Jens
  • 1,293