8.3 Advanced Mathematical Functions

Calc can compute a variety of less common functions that arise in various branches of mathematics. All of the functions described in this section allow arbitrary complex arguments and, except as noted, will work to arbitrarily large precision. They can not at present handle error forms or intervals as arguments.

NOTE: These functions are still experimental. In particular, their accuracy is not guaranteed in all domains. It is advisable to set the current precision comfortably higher than you actually need when using these functions. Also, these functions may be impractically slow for some values of the arguments.

The f g (calc-gamma) [gamma] command computes the Euler gamma function. For positive integer arguments, this is related to the factorial function: ‘gamma(n+1) = fact(n)’. For general complex arguments the gamma function can be defined by the following definite integral: ‘gamma(a) = integ(t^(a-1) exp(-t), t, 0, inf)’. (The actual implementation uses far more efficient computational methods.)

The f G (calc-inc-gamma) [gammaP] command computes the incomplete gamma function, denoted ‘P(a,x)’. This is defined by the integral, ‘gammaP(a,x) = integ(t^(a-1) exp(t), t, 0, x) / gamma(a)’. This implies that ‘gammaP(a,inf) = 1’ for any ‘a’ (see the definition of the normal gamma function).

Several other varieties of incomplete gamma function are defined. The complement of ‘P(a,x)’, called ‘Q(a,x) = 1-P(a,x)’ by some authors, is computed by the I f G [gammaQ] command. You can think of this as taking the other half of the integral, from ‘x’ to infinity.

The functions corresponding to the integrals that define ‘P(a,x)’ and ‘Q(a,x)’ but without the normalizing ‘1/gamma(a)’ factor are called ‘g(a,x)’ and ‘G(a,x)’, respectively (where ‘g’ and ‘G’ represent the lower- and upper-case Greek letter gamma). You can obtain these using the H f G [gammag] and H I f G [gammaG] commands.

The f b (calc-beta) [beta] command computes the Euler beta function, which is defined in terms of the gamma function as ‘beta(a,b) = gamma(a) gamma(b) / gamma(a+b)’, or by ‘beta(a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, 1)’.

The f B (calc-inc-beta) [betaI] command computes the incomplete beta function ‘I(x,a,b)’. It is defined by ‘betaI(x,a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, x) / beta(a,b)’. Once again, the H (hyperbolic) prefix gives the corresponding un-normalized version [betaB].

The f e (calc-erf) [erf] command computes the error function ‘erf(x) = 2 integ(exp(-(t^(2))), t, 0, x) / sqrt(pi)’. The complementary error function I f e (calc-erfc) [erfc] is the corresponding integral from ‘x’ to infinity; the sum ‘erf(x) + erfc(x) = 1’.

The f j (calc-bessel-J) [besJ] and f y (calc-bessel-Y) [besY] commands compute the Bessel functions of the first and second kinds, respectively. In ‘besJ(n,x)’ and ‘besY(n,x)’ the “order” parameter ‘n’ is often an integer, but is not required to be one. Calc’s implementation of the Bessel functions currently limits the precision to 8 digits, and may not be exact even to that precision. Use with care!