# Krawtchouk Polynomials

 Orthogonal Polynomials Home Krawtchouk Polynomials
Krawtchouk polynomials, Kn(x; p, N), N a positive integer, 0 < p < 1, n = 0, … , N, are orthogonal on the support interval [0,N] with weight function
 w(x) = Σn=0N CxN p x (1 - p) N - x &delta(x - n)
and normalized by the requirement that the leading coefficient Kn(x; p, N) is 1 / n!.

Kn(x; p, N) satisfies the three-term recurrence relation
 (n + 1) Kn+1(x) = [ x - n + p ( N - 2n) ] Kn(x) - n (N - n + 1) p (1 - p) Kn-1(x) for n ≥ 1
with starting values
 K0(x; p, N) = 1, K1(x; p, N) = x - p N.

#### Function List

• double Krawtchouk_Kn( double x, double p, int N, int n )

This function returns Kn(x; p, N) where Kn(x; p, N) is described above.

• long double xKrawtchouk_Kn( long double x, long double p, int N, int n )

This function returns Kn(x; p, N) where Kn(x; p, N) is described above.

• void Krawtchouk_Kn_Sequence( double K[ ], double x, double p, int N, int max_n )

This function returns Kn(x; p, N), for n = 0, 1, …, max_n in the array K[ ] where Kn(x; p, N) is described above. Note that K[ ] should be declared as double K[L] where
L ≥ max_n + 1.

• void xKrawtchouk_Kn_Sequence( long double K[ ], long double x, long double p, int N, int max_n )

This function returns Kn(x; p, N), for n = 0, 1, …, max_n in the array K[ ] where Kn(x; p, N) is described above. Note that K[ ] should be declared as long double K[L] where
L ≥ max_n + 1.

• double Krawtchouk_Kn_Series( double x, double p, int N, double a[ ], int degree )

This function returns Σk=0na[k] Kk(x; p, N) where n = degree and Kk(x; p, N) for
k = 0, …, n is described above.

• long double xKrawtchouk_Kn_Series( long double x, long double p, int N, long double a[ ], int degree )

This function returns Σk=0na[k] Kk(x; p, N) where n = degree and Kk(x; p, N) for
k = 0, …, n is described above.

#### Source Code

C source code is available for these routines: