Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
583 additions
and
1 deletion.
There are no files selected for viewing
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
52 changes: 52 additions & 0 deletions
52
data/Integrals/Periods/Volume_of_the_unit_ball/collection.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
29
data/Integrals/Periods/Volume_of_the_unit_ball/generate.sage
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Oops, something went wrong.