One Simple Equation to Compute e, base of the natural logarithm


In [here], mathematical constant tex_b0ae8ac94ba8dcb947494ecd8411ed90 One Simple Equation to Compute e, base of the natural logarithm algorithms math python is introduced. Below, a simple equation is presented to compute its value.

tex_763573582b765fcfc6a2a57e74be9f6e One Simple Equation to Compute e, base of the natural logarithm algorithms math python , when tex_eaacffd171ceeb95ac4619e974b33b69 One Simple Equation to Compute e, base of the natural logarithm algorithms math python .

Therefore, tex_07baee26b11d17fadc32609a4e1b0565 One Simple Equation to Compute e, base of the natural logarithm algorithms math python is a infinity loopless irrational number.

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env python
from math import e
 
s = 1
t = 1
maxn = 21
 
for x in range(1, maxn):
    t *= x
    s += 1.0 / t
    print "Iteration %d=%.10f, err=%.20f" % (x, s, abs(s - e))
 
print e
#!/usr/bin/env python
from math import e

s = 1
t = 1
maxn = 21

for x in range(1, maxn):
    t *= x
    s += 1.0 / t
    print "Iteration %d=%.10f, err=%.20f" % (x, s, abs(s - e))

print e

The equation is efficient in computing its value when iterations reach 17, the error is approximately 0.00000000000000044409

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Iteration 1=2.0000000000, err=0.71828182845904509080
Iteration 2=2.5000000000, err=0.21828182845904509080
Iteration 3=2.6666666667, err=0.05161516179237857216
Iteration 4=2.7083333333, err=0.00994849512571205352
Iteration 5=2.7166666667, err=0.00161516179237874979
Iteration 6=2.7180555556, err=0.00022627290348964380
Iteration 7=2.7182539683, err=0.00002786020507672404
Iteration 8=2.7182787698, err=0.00000305861777505356
Iteration 9=2.7182815256, err=0.00000030288585284310
Iteration 10=2.7182818011, err=0.00000002731266057765
Iteration 11=2.7182818262, err=0.00000000226055218988
Iteration 12=2.7182818283, err=0.00000000017287637988
Iteration 13=2.7182818284, err=0.00000000001228572799
Iteration 14=2.7182818285, err=0.00000000000081490370
Iteration 15=2.7182818285, err=0.00000000000005018208
Iteration 16=2.7182818285, err=0.00000000000000222045
Iteration 17=2.7182818285, err=0.00000000000000044409
Iteration 18=2.7182818285, err=0.00000000000000044409
Iteration 19=2.7182818285, err=0.00000000000000044409
Iteration 20=2.7182818285, err=0.00000000000000044409
2.71828182846
Iteration 1=2.0000000000, err=0.71828182845904509080
Iteration 2=2.5000000000, err=0.21828182845904509080
Iteration 3=2.6666666667, err=0.05161516179237857216
Iteration 4=2.7083333333, err=0.00994849512571205352
Iteration 5=2.7166666667, err=0.00161516179237874979
Iteration 6=2.7180555556, err=0.00022627290348964380
Iteration 7=2.7182539683, err=0.00002786020507672404
Iteration 8=2.7182787698, err=0.00000305861777505356
Iteration 9=2.7182815256, err=0.00000030288585284310
Iteration 10=2.7182818011, err=0.00000002731266057765
Iteration 11=2.7182818262, err=0.00000000226055218988
Iteration 12=2.7182818283, err=0.00000000017287637988
Iteration 13=2.7182818284, err=0.00000000001228572799
Iteration 14=2.7182818285, err=0.00000000000081490370
Iteration 15=2.7182818285, err=0.00000000000005018208
Iteration 16=2.7182818285, err=0.00000000000000222045
Iteration 17=2.7182818285, err=0.00000000000000044409
Iteration 18=2.7182818285, err=0.00000000000000044409
Iteration 19=2.7182818285, err=0.00000000000000044409
Iteration 20=2.7182818285, err=0.00000000000000044409
2.71828182846

As you can see, the value will not be improved. This is mainly limited by the floating point precision by programing languages, e.g. Python, in this case.

See also: Simple and Efficient C Program to Compute the Mathematic Constant E (Euler’s number)

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
369 words
Last Post: E, base of the natural logarithm
Next Post: How Many Iterations to Compute e, the base of the Natural Log ?

The Permanent URL is: One Simple Equation to Compute e, base of the natural logarithm

Leave a Reply