Created
May 20, 2016 06:00
-
-
Save AFAgarap/a45e0427dd1764c69ac2548d32f1e7ac to your computer and use it in GitHub Desktop.
Maclaurin series for e^x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
print("\t\t\t10th degree of Maclaurin Series, e^x") | |
x = float(input("Enter value of x: ")) | |
answer = 1; i = 1 | |
while(i < 10): | |
answer += (x ** i) / factorial(i) | |
i += 1 | |
print(answer) | |
def factorial(number): | |
return 1 if (number == 0) else (number * factorial(number - 1)) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment