C++ Technical Report 1
TR1的內容 > 數值工具 > 數學函式

新的<cmath>/<math.h>头文件 - beta、legendre等
23種數學函式
| 函数名 | 函数原型 | 数学表达式 |
| --- | --- | --- |
| 连带拉盖尔多项式 | double assoc_laguerre( unsigned n, unsigned m, double x ) ; |  {L_{n}}^{m}(x)=(-1)^{m}{\frac {d^{m}}{dx^{m}}}L_{n+m}(x),{\text{ for }}x\geq 0 |
| 连带勒让德多项式 | double assoc_legendre( unsigned l, unsigned m, double x ) ; |  {P_{l}}^{m}(x)=(1-x^{2})^{m/2}{\frac {d^{m}}{dx^{m}}}P_{l}(x),{\text{ for }}x\geq 0 |
| Beta 函数 | double beta( double x, double y ) ; |  \mathrm {B} (x,y)={\frac {\Gamma (x)\Gamma (y)}{\Gamma (x+y)}} |
| 第一类完全椭圆积分 | double comp_ellint_1( double k ) ; |  K(k)=F\left(k,\textstyle {\frac {\pi }{2}}\right)=\int _{0}^{\frac {\pi }{2}}{\frac {d\theta }{\sqrt {1-k^{2}\sin ^{2}\theta }}} |
| 第二类完全椭圆积分 | double comp_ellint_2( double k ) ; |  E\left(k,\textstyle {\frac {\pi }{2}}\right)=\int _{0}^{\frac {\pi }{2}}{\sqrt {1-k^{2}\sin ^{2}\theta }}\;d\theta  |
| 第三类完全椭圆积分 | double comp_ellint_3( double k , double nu ) ; |  \Pi \left(\nu ,k,\textstyle {\frac {\pi }{2}}\right)=\int _{0}^{\frac {\pi }{2}}{\frac {d\theta }{(1-\nu \sin ^{2}\theta ){\sqrt {1-k^{2}\sin ^{2}\theta }}}} |
| 合流超几何函数 | double conf_hyperg( double a, double c, double x ) ; |  F(a,c,x)={\frac {\Gamma (c)}{\Gamma (a)}}\sum _{n=0}^{\infty }{\frac {\Gamma (a+n)x^{n}}{\Gamma (c+n)n!}} |
| 第一类变形贝塞尔函数 | double cyl_bessel_i( double nu, double x ) ; |  I_{\nu }(x)=i^{-\nu }J_{\nu }(ix)=\sum _{k=0}^{\infty }{\frac {(x/2)^{\nu +2k}}{k!\;\Gamma (\nu +k+1)}},{\text{ for }}x\geq 0 |
| 第二类变形贝塞尔函数 | double cyl_bessel_j( double nu, double x ) ; |  J_{\nu }(x)=\sum _{k=0}^{\infty }{\frac {(-1)^{k}\;(x/2)^{\nu +2k}}{k!\;\Gamma (\nu +k+1)}},{\text{ for }}x\geq 0 |
| 第三类变形贝塞尔函数 | double cyl_bessel_k( double nu, double x ) ; |  {\begin{aligned}K_{\nu }(x)&=\textstyle {\frac {\pi }{2}}i^{\nu +1}{\big (}J_{\nu }(ix)+iN_{\nu }(ix){\big )}\\&={\begin{cases}\displaystyle {\frac {I_{-\nu }(x)-I_{\nu }(x)}{\sin \nu \pi }},&{\text{for }}x\geq 0{\text{ and }}\nu \notin \mathbb {Z} \\[10pt]\displaystyle {\frac {\pi }{2}}\lim _{\mu \to \nu }{\frac {I_{-\mu }(x)-I_{\mu }(x)}{\sin \mu \pi }},&{\text{for }}x<0{\text{ and }}\nu \in \mathbb {Z} \\\end{cases}}\end{aligned}} |
| 柱诺依曼函数 第二类柱贝塞尔函数 | double cyl_neumann( double nu, double x ) ; |  N_{\nu }(x)={\begin{cases}\displaystyle {\frac {J_{\nu }(x)\cos \nu \pi -J_{-\nu }(x)}{\sin \nu \pi }},&{\text{for }}x\geq 0{\text{ and }}\nu \notin \mathbb {Z} \\[10pt]\displaystyle \lim _{\mu \to \nu }{\frac {J_{\mu }(x)\cos \mu \pi -J_{-\mu }(x)}{\sin \mu \pi }},&{\text{for }}x<0{\text{ and }}\nu \in \mathbb {Z} \\\end{cases}} |
| 第一类不完全椭圆积分 | double ellint_1( double k, double phi ) ; |  F(k,\phi )=\int _{0}^{\phi }{\frac {d\theta }{\sqrt {1-k^{2}\sin ^{2}\theta }}},{\text{ for }}\left|k\right|\leq 1 |
| 第二类不完全椭圆积分 | double ellint_2( double k, double phi ) ; |  \displaystyle E(k,\phi )=\int _{0}^{\phi }{\sqrt {1-k^{2}\sin ^{2}\theta }}d\theta ,{\text{ for }}\left|k\right|\leq 1 |
| 第三类不完全椭圆积分 | double ellint_3( double k, double nu, double phi ) ; |  \Pi (k,\nu ,\phi )=\int _{0}^{\phi }{\frac {d\theta }{\left(1-\nu \sin ^{2}\theta \right){\sqrt {1-k^{2}\sin ^{2}\theta }}}},{\text{ for }}\left|k\right|\leq 1 |
| 指数积分 | double expint( double x ) ; |  {\mbox{E}}i(x)=-\int _{-x}^{\infty }{\frac {e^{-t}}{t}}\,dt |
| 埃爾米特多項式 | double hermite( unsigned n, double x ) ; |  H_{n}(x)=(-1)^{n}e^{x^{2}}{\frac {d^{n}}{dx^{n}}}e^{-x^{2}}\,\! |
| 超几何级数 | double hyperg( double a, double b, double c, double x ) ; |  F(a,b,c,x)={\frac {\Gamma (c)}{\Gamma (a)\Gamma (b)}}\sum _{n=0}^{\infty }{\frac {\Gamma (a+n)\Gamma (b+n)}{\Gamma (c+n)}}{\frac {x^{n}}{n!}} |
| 拉盖尔多项式 | double laguerre( unsigned n, double x ) ; |  L_{n}(x)={\frac {e^{x}}{n!}}{\frac {d^{n}}{dx^{n}}}\left(x^{n}e^{-x}\right),{\text{ for }}x\geq 0 |
| 勒让德多项式 | double legendre( unsigned l, double x ) ; |  P_{l}(x)={1 \over 2^{l}l!}{d^{l} \over dx^{l}}(x^{2}-1)^{l},{\text{ for }}\left|x\right|\leq 1 |
| 黎曼zeta函数 | double riemann_zeta( double x ) ; |  \mathrm {Z} (x)={\begin{cases}\displaystyle \sum _{k=1}^{\infty }k^{-x},&{\text{for }}x>1\\[10pt]\displaystyle 2^{x}\pi ^{x-1}\sin \left({\frac {x\pi }{2}}\right)\Gamma (1-x)\zeta (1-x),&{\text{for }}x<1\\\end{cases}} |
| 第一类球贝塞尔函数 | double sph_bessel( unsigned n, double x ) ; |  j_{n}(x)={\sqrt {\frac {\pi }{2x}}}J_{n+1/2}(x),{\text{ for }}x\geq 0 |
| 球谐函数 | double sph_legendre( unsigned l, unsigned m, double theta ) ; |  Y_{l}^{m}(\theta ,0){\text{ where }}Y_{l}^{m}(\theta ,\phi )=(-1)^{m}\left[{\frac {(2l+1)}{4\pi }}{\frac {(l-m)!}{(l+m)!}}\right]^{1 \over 2}P_{l}^{m}(\cos \theta )e^{\mathrm {i} m\phi },{\text{ for }}|m|\leq l |
| 球诺依曼函数 第二类球贝塞尔函数 | double sph_neumann( unsigned n, double x ) ; |  n_{n}(x)=\left({\frac {\pi }{2x}}\right)^{\frac {1}{2}}N_{n+{\frac {1}{2}}}(x),{\text{ for }}x\geq 0 |