Advanced math functions

Revision as of 18:56, 4 August 2017 by Lchrisman (talk | contribs) (Organization now matches the 5.0 hierarchy more closely.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

These functions can be accessed under the Definition menu Advanced Math command, or in the Object Finder dialog, Advanced Math library. Functions in this section are generally for more advanced mathematical users than those found in Math functions. There are additional advanced math functions covered in Importance weights.

BesselJ(x, n), BesselY(x, n), BesselI(x, n), BesselK(x, n)

Bessel functions of the first kind (J), second kind (Y), and modified Bessel functions of the first (I) and second (K) kinds. These are used in engineering applications involving harmonics in cylindrical coordinates. The second parameter, «n», is the order of the Bessel function and can be integer or fractional. When «n» is non-integer, «x» must be non-negative. These functions are not exposed on the Advanced Math library menu.

See more at BesselJ(), BesselY(), BesselI() and BesselK().

Bit functions

The Bit functions manipulate the binary bits of integer numbers, and include the functions BitAnd,BitOr, BitNot, BitXOr, BitCount and BitShift. In the following examples, the binary number format is used for the results. Numbers can be entered in binary by beginning with 0b.

BitAnd( [0b111110, 0b101111,0b111011] ) → 0b101010
Index s := 0..3 do BitOr( BitShift( 0b0110, 4*s, left:true ), s ) → 0b110011001100110
BitCount(0b1011101101111) → 10
BitCount(0b1011101100000,'-0') → 5 { # of trailing zeros }


The combinatorics functions are used to compute the number of arrangements of groups of items, and include:

  • Combinations(k,n): The number of ways «k» items can be selected from «n» total items without replacement.
  • Factorial(n): The number of distinct ways «n» items can be ordered.
  • Partitions(k,n): The number of ways «n» items can be partitions into «k» non-empty groups.
  • Permutations(k,n): The number of different orderings (permutations) of «k» items selected from «n» total items.

All of these can produce extremely large numbers very quickly. In general, exact integer values are possible only for results up to 9e+18 (2^63), and results larger than around 1e+302 will overflow the double floating point representation for numbers and result in a result of Inf.

When dealing with very large combinations that overflow the largest double, the LGamma function can provide an alternative. LGamma(n+1) is equal to Ln(Factorial(n)).

Error (and related) functions

These functions are standard functions in mathematics that involve an integration over [math]\displaystyle{ e^{x^2} }[/math], or their inverse, and include

  • CumNormal and CumNormalInv: The normal distribution function
  • Erf and ErfInv: The error function. Defined for all real numbers, and in Analytica 5.0 or later, also for all complex numbers.
    [math]\displaystyle{ Erf(x) = {2\over\pi} \int_0^x e^{-t^2} dt }[/math]
  • (New to Analytica 5.0) The Dawson function. Defined for both real and complex numbers, it is an integral of Exp(t^2) that is scaled by Exp(-x^2) to avoid numeric overflow. In mathematic texts, it is often written as [math]\displaystyle{ F(x) }[/math] or [math]\displaystyle{ D+(x) }[/math].
  • (New to Analytica 5.0) The Faddeeva function, often denoted as [math]\displaystyle{ w(z) }[/math] in math textbooks. It is a scaled version of an integral of Exp(t^2) designed to avoid numeric overflow issues, and is defined over the complex numbers.

Gamma and Beta functions

The complete and incomplete beta and gamma functions are used extensively in several fields of mathematics and statistics. In Analytica, the functions Beta and Gamma are the beta and gamma distributions, not the beta and gamma functions. The beta and gamma functions are analytic functions that also happen to describe the area under the beta and gamma distributions respectively, so they are closely related, but you should remember that if you need the beta or gamma function, then you'll need one of these:

  • BetaFn(alpha, beta): The (complete) beta function
  • BetaI(x, a, b ): The incomplete beta function
  • BetaIInv( p, a, b ): The inverse of the incomplete beta function. The value of «x» such that BetaI(x,a,b)=p
  • BetaIaInv( p, x, b ): Another inverse of the incomplete beta function. The value of «a» such that BetaI(x,a,b) = p.
  • GammaFn(x): The (complete) gamma function.
  • LGamma(x): The natural log of the complete beta function, equal to Ln(GammaFn(x)), but useful in situations where «x» may be large enough to overflow a double floating point number.
  • GammaI(x,a,b): The incomplete gamma function.
  • GammaIInv(y,a,b): The inverse of the incomplete gamma function. The value «x» in where GammaI(x,a,b)=y.
LGamma(10) → 12.8

Others, covered elsewhere

These advanced math categories are covered on other pages:

Complex number functions

See Complex number functions.

Curve fitting functions

Matrix functions

See Matrix functions.

Numeric integration

See Also


You are not allowed to post comments.