### B.10 Error function, Beta, Gamma and related mathematical functions

The following table describes statements that are used to evaluate the error function, Beta, Gamma and related functions.

 Syntax Mathematical expression Arguments and return values W = erf(X); $\frac{2}{\sqrt{\pi }}\underset{0}{\overset{x}{\int }}{e}^{-{t}^{2}}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t$ W is a matrix with values equal to error function evaluated at each entry of X. The function works element-wise. X must be a matrix or dataset W = erfc(X); $\frac{2}{\sqrt{\pi }}\underset{x}{\overset{\infty }{\int }}{e}^{-{t}^{2}}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t$ W is a matrix with values equal to complementary error function evaluated at each entry of X. The function works element-wise. X must be a matrix or dataset W = betafunc(X, Y); $B\left(x\right)=\underset{0}{\overset{1}{\int }}{t}^{x-1}{\left(1\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}t\right)}^{y-1}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t$ W is a matrix with values equal to the beta function of each entry of X and the corresponding entry of Y. The function works element-wise. X must be a matrix or dataset with positive entries Y must be a matrix or dataset with positive entries The dimensions of X must be equal to the dimensions of Y If X or Y contain non-positive entries then the corresponding entries of W are set to nan or inf W = lbetafunc(X, Y); $log\left[B\left(x,y\right)\right]$ W is a matrix with values equal to the natural logarithm of the beta function of each entry of X and the corresponding entry of Y. The function works element-wise. X must be a matrix or dataset with positive entries Y must be a matrix or dataset with positive entries The dimensions of X must be equal to the dimensions of Y If X or Y contain non-positive entries then the corresponding entries of W are set to nan or inf W = betainc(Z, X, Y); ${I}_{z}\left(x,y\right)=\frac{\underset{0}{\overset{z}{\int }}{t}^{x-1}{\left(1\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}t\right)}^{y-1}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t}{B\left(x,y\right)}$ W is a matrix with values equal to the normalized/regularized lower incomplete beta function of each entry of X and the corresponding entry of Y. The function works element-wise. Z must be a matrix or dataset with positive entries X must be a matrix or dataset with non-negative entries X, Y and Z must have equal dimensions If Z contains negative entries or entries above one an error is produced If X or Y contain non-positive entries then an error is produced W = gammafunc(X); $\Gamma \left(x\right)=\underset{0}{\overset{\infty }{\int }}{t}^{x-1}{e}^{-t}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t$ W is a matrix with values equal to the gamma function of each entry of X. The function works element-wise. X must be a matrix or dataset If X contains non-positive integers then the corresponding entries of W are set to nan or inf W = lgammafunc(X); $log\left[\Gamma \left(x\right)\right]$ W is a matrix with values equal to the natural logarithm of the gamma function of each entry of X. The function works element-wise. X must be a matrix or dataset If X contains non-positive entries an error is produced W = gammainc(Z, X); $\frac{\gamma \left(z,x\right)}{\Gamma \left(x\right)}=\frac{\underset{0}{\overset{z}{\int }}{t}^{x-1}{e}^{-t}\phantom{\rule{0.3em}{0ex}}\mathrm{d}t}{\Gamma \left(x\right)}$ W is a matrix with values equal to the normalized/regularized lower incomplete gamma function of each entry of X. The function works element-wise. Z must be a matrix or dataset with positive entries X must be a matrix or dataset with non-negative entries the dimensions of X must be equal to the dimensions of of Z If X or Z contain non-positive entries then an error is produced W = mvgammafunc(X, k); ${\Gamma }_{k}\left(x\right)={\pi }^{\frac{k\left(k\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}1\right)}{4}}\prod _{j=1}^{k}\Gamma \phantom{\rule{0.3em}{0ex}}\left(x\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}\frac{1\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}j}{2}\right)$ W is a matrix with values equal to the $k$-dimensional gamma function of each entry of X. The function works element-wise. X must be a matrix or dataset k must be a positive integer If X contains non-positive integers then the corresponding entries of W are set to nan or inf W = lmvgammafunc(X, k); $log\left[{\Gamma }_{k}\left(x\right)\right]$ W is a matrix with values equal to the natural logarithm of the $k$-dimensional gamma function of each entry of X. The function works element-wise. X must be a matrix or dataset k must be a positive integer If X contains non-positive integers then the corresponding entries of W are set to nan or inf