org.gwoptics.mathutils
Class mathUtils

java.lang.Object
  extended by org.gwoptics.mathutils.mathUtils

public final class mathUtils
extends java.lang.Object

Mathutils is a class that provides a set of utility functions for mathematical operations. History 0.3.5 Added lookup tables for factorial and binomial functions, added gamma function as well.

Since:
0.1.1
Author:
Andreas Freise 05/6/2009

Constructor Summary
mathUtils()
           
 
Method Summary
static long binomial(int n, int k)
          This function computes the binomial coefficient b(n,k).
static long factorial(long n)
          This function computes the factorial of an long integer
static java.lang.Double hermite(int n, double x)
          This function computes the Hermite polynomial H_n(x).
static java.lang.Double laguerre(int p, int l, double x)
          Function to compute the associated Laguerre Polynomial L_p^l(x).
static double logFactorial(int n)
          This function returns the logarithmic factorial log(n!).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

mathUtils

public mathUtils()
Method Detail

factorial

public static long factorial(long n)
This function computes the factorial of an long integer

Parameters:
n - long integer
Returns:
factorial n!

logFactorial

public static double logFactorial(int n)
This function returns the logarithmic factorial log(n!). Uses lookup table for

Parameters:
n - input argument
Returns:
logarithmic factorial log(n!)

binomial

public static long binomial(int n,
                            int k)
This function computes the binomial coefficient b(n,k).

Parameters:
n - input argument (integer)
k - input argument (integer)
Returns:
binomial coefficients b(n,k)

hermite

public static java.lang.Double hermite(int n,
                                       double x)
This function computes the Hermite polynomial H_n(x). This is based on the description in Siegman `Lasers' p.686. It uses the recursion relation: H_{n+1}(x) = 2x H_n(x) - 2n H_{n-1}(x) where the first four terms are given by: H_0 =1, H_1(x) = 2x, H_2(x) = 4x^2 - 2, H_3(x) = 8x^3 - 12x.

Parameters:
n - order of the polynomial (integer)
x - argument (real number)
Returns:
Hermite polynomial H_n(x)

laguerre

public static java.lang.Double laguerre(int p,
                                        int l,
                                        double x)
Function to compute the associated Laguerre Polynomial L_p^l(x).

Parameters:
p - radial mode index
l - azimuthal mode index
x - argument
Returns:
value of polynomial


processing library gwoptics by Daniel Brown and Andreas Freise. (c) 2009 onwards