Skip to content

Commit

Permalink
added volume of d-ball
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatschke committed Mar 12, 2021
1 parent f45b630 commit ad2464d
Show file tree
Hide file tree
Showing 4 changed files with 583 additions and 1 deletion.
Expand Up @@ -23,7 +23,7 @@ Comments:
Formulas:
formula-sin: >
$E(m) = \int_0^{\pi/2} \sqrt{1-m\sin^2\theta}} d\theta$.
$E(m) = \int_0^{\pi/2} \sqrt{1-m\sin^2\theta} d\theta$.
Programs:

Expand Down
52 changes: 52 additions & 0 deletions data/Integrals/Periods/Volume_of_the_unit_ball/collection.yaml
@@ -0,0 +1,52 @@
ID: INPUT{id.yaml}

Title: >
Volume of the $d$-dimensional unit ball
Definition: >
$B_d = \text{vol}(\{x\in\mathbb{R}^d: |x|\leq 1\})$ is
the volume of the unit ball in $d$-dimensional Euclidean space.
Parameters:
d:
display: $d$
type: Z
constraints: $d \geq 0$

Comments:

Formulas:
formula-gamma: >
$B_d = \frac{\pi^{d/2}}{\Gamma(d/2+1)}$.
formula-only-gamma: >
$B_d = \frac{2^d\Gamma(1+1/2)^d}{\Gamma(1+d/2)}$.
formula-sphere: >
$dB_d = S_{d-1}$, where $S_{d-1}$ denotes the
$(d-1)$-dimensional volume of the unit sphere in $\mathbb{R}^d$.
Programs:

References:

Links:
Wiki:
title: "Wikipedia: Volume of an n-ball"
url: https://en.wikipedia.org/wiki/Volume_of_an_n-ball

Similar tables:

Keywords:

Tags:
- elementary geometry
- integral
- period

Data properties:
type: R
complete: no

Display properties:
number-header: $B_d$

Numbers: INPUT{numbers.yaml}
29 changes: 29 additions & 0 deletions data/Integrals/Periods/Volume_of_the_unit_ball/generate.sage
@@ -0,0 +1,29 @@
import yaml
import os
from utils.utils import numbers_to_yaml
from utils.utils import real_interval_to_sage_string


path = 'data/Integrals/Periods/Volume_of_the_unit_ball/'

prec10 = 100 #relative precision in base 10

d_range = [0..500]

RIFprec = RealIntervalField(prec10 * 3.4 * 2)

numbers = {}
for d in d_range:
print("d:",d)

number = RIFprec(pi^(d/2)/gamma(d/2+1))

number_str = real_interval_to_sage_string(
RIFprec(number),
max_digits = prec10,
).replace('?','')

numbers[str(d)] = number_str

filename = os.path.join(path, 'numbers.yaml')
yaml.dump(numbers, stream = open(filename, 'w'), sort_keys = False)

0 comments on commit ad2464d

Please sign in to comment.