Python Program to Calculate Value Euler's Number (e)
In mathematics, constant e is also known as Euler's number. It is named after the Swiss mathematician Leonhard Euler.
Value of e
can be calculated using infinite series. This python program calculates value of Euler's number using series approach.
Python Source Code: Calculation of Euler's Number
# Calculation of Euler Number e
import math
def euler(n):
t_sum = 0
for i in range(n):
term = 1/math.factorial(i)
t_sum = t_sum + term
return t_sum
# Reading number of terms to be considered in series
terms = int(input("Enter number of terms: "))
# Function call
e = euler(terms)
# Displaying result
print("e = ", e)
Output
Enter number of terms: 1000 e = 2.7182818284590455