Created
May 9, 2023 18:55
-
-
Save nschloe/d0c906b11f1fdd173a8c58e3308e603c to your computer and use it in GitHub Desktop.
Volumes of spheres of radius 1 in higher dimensions
This file contains 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
from math import tau | |
import matplotlib.pyplot as plt | |
n_max = 20 | |
sphere_vols = [2, tau] | |
for n in range(3, n_max + 1): | |
sphere_vols.append(sphere_vols[n-2] * tau / (n-2)) | |
plt.plot(range(1, n_max + 1), sphere_vols, "o") | |
plt.title("Volumes of spheres of radius 1 in higher dimensions") | |
plt.xlabel("n") | |
plt.show() |
Author
nschloe
commented
May 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment