Multidimensional volumes and monomial integrals.
ndim computes all kinds of volumes and integrals of monomials over such volumes in a fast, numerically stable way, using recurrence relations.
Install ndim from PyPI with
pip install ndim
Licenses for personal and academic use can be purchased here. You'll receive a confirmation email with a license key. Install the key with
slim install <your-license-key>
on your machine and you're good to go.
For commercial use, please contact support@mondaytech.com.
import ndim
val = ndim.nball.volume(17)
print(val)
val = ndim.nball.integrate_monomial((4, 10, 6, 0, 2), lmbda=-0.5)
print(val)
# or nsphere, enr, enr2, ncube, nsimplex
0.14098110691713894
1.0339122278806983e-07
All functions have the symbolic
argument; if set to True
, computations are performed
symbolically.
import ndim
vol = ndim.nball.volume(17, symbolic=True)
print(vol)
512*pi**8/34459425
A PDF version of the text can be found here.
This note gives closed formulas and recurrence expressions for many
- Volume.
- Monomial integration.
- Volume.
- Monomial integration.
Note that both numerator and denominator in the closed expression will assume very large values even for polynomials of moderate degree. This can lead to difficulties when evaluating the expression on a computer; the registers will overflow. A common countermeasure is to use the log-gamma function,
but a simpler and arguably more elegant solution is to use the recurrence. This holds true for all such expressions in this note.
- Volume.
- Monomial integral.
-
Volume.
|S_n| = \frac{\sqrt{\pi}^n}{\Gamma(\frac{n}{2}+1)} = \begin{cases} 1&\text{if $n = 0$}\\ 2&\text{if $n = 1$}\\ |S_{n-2}| \times \frac{2\pi}{n}&\text{otherwise} \end{cases}
-
Monomial integral.
with
- Volume.
- Monomial integration.
Gegenbauer with
- Volume.
- Monomial integration.
Gegenbauer with
- Volume.
- Monomial integration.
As appearing in the Cauchy distribution and Student's t-distribution.
- Volume.
$2 \lambda > n$ .
- Monomial integration.
$2 \lambda > n + \sum_i k_i$ .
- Volume
- Monomial integration.
with
- Volume.
- Monomial integration.
- Volume.
- Monomial integration.