Skip to content

Instantly share code, notes, and snippets.

@yashppawar
Created October 9, 2021 12:06
Show Gist options
  • Save yashppawar/afb75f5a06b335a3cbb1ef9abe63f459 to your computer and use it in GitHub Desktop.
Save yashppawar/afb75f5a06b335a3cbb1ef9abe63f459 to your computer and use it in GitHub Desktop.
finding the value of e (eulers number) using limits and approaching, in python.
import maths
# solving for the value of e using approaching.
def e(num: int) -> int:
return math.pow(1 + 1 / num, num)
for i in range(1, int(1e10), 1000):
# slowly aproaching towards the value of e
print(f"{i=} {e=}")
# using limits, lim{num -> inf} e(num)
print(f"e using a large number {e(1e11)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment