📄 mf_factorial.hlp
字号:
{smcl}
{* 21mar2005}{...}
{cmd:help mata factorial()}
{hline}
{* index factorial()}{...}
{* index lnfactorial()}{...}
{* index lngamma()}{...}
{* index gamma()}{...}
{* index digamma()}{...}
{* index trigamma()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] factorial() -- Factorial and gamma function}
{title:Syntax}
{p 8 12 2}
{it:real{bind: }matrix}{bind: }
{cmd:factorial(}{it:real matrix R}{cmd:)}
{p 8 12 2}
{it:real{bind: }matrix}
{cmd:lnfactorial(}{it:real matrix R}{cmd:)}
{p 8 12 2}
{it:numeric matrix}{bind: }
{cmd:lngamma(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric matrix}{bind: }
{cmd:gamma(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:real{bind: }matrix}{bind: }
{cmd:digamma(}{it:real matrix R}{cmd:)}
{p 8 12 2}
{it:real{bind: }matrix}{bind: }
{cmd:trigamma(}{it:real matrix R}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:factorial(}{it:R}{cmd:)} returns the elementwise factorial of {it:R}.
{p 4 4 2}
{cmd:lnfactorial(}{it:R}{cmd:)} returns the elementwise
ln(factorial({it:R}{cmd:))}, calculated differently. Very large values of
{it:R} may be evaluated.
{p 4 4 2}
{cmd:lngamma(}{it:Z}{cmd:)} returns the elementwise
{cmd:ln(gamma(}{it:Z}{cmd:))}, calculated differently.
Very large values of {it:Z} may be evaluated.
Function returns real if {it:Z} is real, complex if {it:Z} is complex. Thus,
{cmd:lngamma(}-2.5{cmd:)}=={cmd:.} whereas
{cmd:lngamma(}-2.5+0i{cmd:)} == -.056244 + 3.1416i.
{p 4 4 2}
{cmd:gamma(}{it:Z}{cmd:)} returns {cmd:exp(lngamma(}{it:Z}{cmd:))} for complex
arguments and {cmd:Re(exp(lngamma(C(}{it:Z}{cmd:))))} for real arguments.
Thus, {cmd:gamma()} can correctly calculate, say,
{cmd:gamma(}-2.5{cmd:)} even for real arguments.
{p 4 4 2}
{cmd:digamma(}{it:R}{cmd:)} returns the derivative of {cmd:lngamma()}
for {it:R}>0, sometimes called the psi function. Note that
{cmd:digamma()} requires a real argument.
{p 4 4 2}
{cmd:trigamma(}{it:R}{cmd:)} returns the second derivative of {cmd:lngamma()}
for {it:R}>0. Note that
{cmd:trigamma()} requires a real argument.
{title:Conformability}
{p 4 4 2}
All functions return a matrix of the same dimension as input,
containing element-by-element calculated results.
{title:Diagnostics}
{p 4 4 2}
{cmd:factorial()} returns missing for noninteger arguments, negative
arguments, and arguments > 167.
{p 4 4 2}
{cmd:lnfactorial()} returns missing for noninteger arguments, negative
arguments, and arguments > 2,147,483,647.
{p 4 4 2}
{cmd:lngamma()} returns missing for 0, negative integer arguments, negative
arguments < -2,147,483,647, and arguments > 1e+308.
{p 4 4 2}
{cmd:gamma()} returns missing for real arguments > 171,
for negative integer arguments,
and for arguments < -2,147,483,647.
{p 4 4 2}
{cmd:digamma()} returns missing for 0 and negative integer arguments,
and for arguments < -10,000,000.
{p 4 4 2}
{cmd:trigamma()} returns missing for 0 and negative integer arguments,
and for arguments < -10,000,000.
{title:Source code}
{p 4 4 2}
{view gamma.mata, adopath asis:gamma.mata};
remaining functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] factorial()}
{p 4 13 2}
Online: help for
{bf:{help m4_scalar:[M-4] scalar}},
{bf:{help m4_statistical:[M-4] statistical}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -