Skip to content

Instantly share code, notes, and snippets.

@secemp9
Created June 3, 2024 05:23
Show Gist options
  • Save secemp9/074a375051b89ea1e85ac2acf68e3ba0 to your computer and use it in GitHub Desktop.
Save secemp9/074a375051b89ea1e85ac2acf68e3ba0 to your computer and use it in GitHub Desktop.
infinite series example in python code
def sum_series(n):
total_sum = 0
for k in range(1, n + 1):
total_sum += 1 / (2 ** k)
return total_sum
n = 1000 # Number of terms to approximate the sum
result = sum_series(n)
print("Approximate sum of the series:", result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment