### Introduction

An expansion of continuous probability density functions or cumulative distribution functions into a series of orthogonal functions constructed from knowledge of moments of the probability density function can serve as a valuable tool in approximating either the density or distribution function when knowledge of the probability density function is limited to its moments. A classic example of a series of this type is the Gram-Charlier series [1]. Unfortunately, casual use of such a series is thwarted by the nontrivial relation between the series coefficients and the moments. Evaluation of more than a few coefficients of such a series is tedious at best.

Fortunately for the Mathematica user, the tedium can be eradicated. This paper describes a package, `ProbabilitySeries`, which defines functions for generating the formal expansion of a density or distribution function into a series of orthogonal polynomials. Specifically, functions are provided for finding the Gram-Charlier series and what are referred to here as the Gamma-series and Beta-series. The three expansions are based on the Hermite, Laguerre, and Jacobi orthogonal polynomials. Each of these polynomials is orthogonal over an interval with respect to its corresponding weight functions. These weight functions may be written in terms of the standard Gaussian, Gamma, and Beta density functions, respectively [2]. For each density function expansion considered below, the zero-order term is one of these common density functions.

Although application of these series can only briefly be discussed in the limited space here, it must be mentioned that in general there is no guarantee of convergence for the series discussed above, nor may a probability density function be uniquely determined by its moments alone [3]. Conditions under which convergence occurs are discussed in [1]. The moment methods considered here are most safely applied when there is prior reason to expect that the unknown density may be closely approximated by the weight function underlying the series expansion. A typical example would be a sum, , of random variables to which the central limit theorem is applicable. The probability density of such a sum may be approximated by a Gaussian density function when is large. Truncations of the Gram-Charlier series may provide significant improvement over use of the Gaussian density alone, as will be evident from examples. In cases where or , the Gamma-series or Beta-series, respectively, may provide an improved approximation over the Gram-Charlier series, as noted in [4].