SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Caleb Dahlke
Jason Pacheco
Gaussian mixture models (GMMs) are fundamental to machine learning due to their flexibility as approximating densities. However, uncertainty quantification of GMMs remains a challenge as differential entropy lacks a closed form. This paper explores polynomial approximations, specifically Taylor and Legendre, to the GMM entropy from a theoretical and practical perspective. We provide new analysis of a widely used approach due to Huber et al. (2008) and show that the series diverges under simple conditions. Motivated by this divergence we provide a novel Taylor series that is provably convergent to the true entropy of any GMM. We demonstrate a method for selecting a center such that the series converges from below, providing a lower bound on GMM entropy. Furthermore, we demonstrate that orthogonal polynomial series result in more accurate polynomial approximations. Experimental validation supports our theoretical results while showing that our method is comparable in computation to Huber et al. We also show that in application, the use of these polynomial approximations, such as in Nonparametric Variational Inference, rely on the convergence of the methods in computing accurate approximations. This work contributes useful analysis to existing methods while introducing novel approximations supported by firm theoretical guarantees.
Entropy is a natural measure of uncertainty and is fundamental to many information-theoretic quantities such as mutual information (MI) and Kullback-Leibler (KL) divergence [8]. As a result, entropy plays a key role in many problems of ML including model interpretation [7], feature selection [6], and representation learning [27]. It is often used in the data acquisition process as in active learning [25, 26], Bayesian optimal experimental design [17, 5, 3], and Bayesian optimization [13]. Yet, despite its important role entropy is difficult to calculate in general.
One such case is the Gaussian mixture model (GMM), where entropy lacks a closed form and is the focus of this paper. GMMs are fundamental to machine learning and statistics due to their property as universal density approximators [18]. However, the lack of a closed-form entropy requires approximation, often via Monte Carlo expectation. Such stochastic estimates can be undesirable as computation becomes coupled with sample size and a deterministic approach is often preferred. Simple deterministic bounds can be calculated via Jensen's inequality or Gaussian moment matching [14]. Such bounds are often too loose to be useful, leading to other options such as variational approximations [21, 10] and neural network-based approximation [2]. Yet, these deterministic estimators do not allow a straightforward tradeoff of computation and accuracy as in the Monte Carlo setting.
Polynomial series approximations are both deterministic and provide a mechanism for computation-accuracy tradeoff by varying the polynomial degree. In this paper we focus on three such polynomial approximations of the GMM entropy. We begin with the widely used approximation of Huber et al. (2008). While this approximation yields good empirical accuracy in many settings, a proof of
convergence is lacking. In this work we show that the Huber et al. approximation in fact does not converge in general, and we provide a divergence criterion (Theorem 3.1). In response to the divergent behavior, we propose two alternative polynomial approximations, a Taylor and Legendre series approximation of GMM entropy that are provably convergent. We establish in Theorem 4.2 and Theorem 4.5 that each series converges everywhere under conditions on the center point or interval, respectively. In Theorem 4.4 we provide a simple mechanism for choosing a value to ensure that these series converge everywhere. We additionally establish, in Theorem 4.3, that our Taylor approximation is a convergent lower bound on the true entropy for any finite polynomial order.
The complexity of both Huber et al. and our proposed methods have similar computation largely driven by polynomial order. To address this we propose an approximation that estimates the higher-order terms by fitting a polynomial regression. This approach requires the evaluation of only three consecutive polynomial orders to approximate higher order series. In this way we can obtain more accurate estimates without the computational overhead of evaluating higher order polynomial terms.
We conclude with an empirical comparison of all polynomial approximations that produce the divergent behavior of the Huber et al. approximation while our proposed methods maintain convergence. We also compare accuracy and computation time for each method across a varaitey of dimensions, number of GMM components, and polynomial orders. Finally, we show an application of our methods in Nonparametric Variational Inference [11] where the guarantees of convergence play a large role in the accuracy of posterior approximation via GMMs.
We briefly introduce required notation and concepts, beginning with a definition of the Gaussian mixture entropy. We will highlight the challenges that preclude efficient computation of entropy. We conclude by defining notation that will be used for discussion of polynomial approximations.
2.1 Gaussian Mixture Entropy
The differential entropy of a continuous-valued random vector  $x \in \mathbb{R}^d$  with a probability density function  $p(x)$  is given by,
$$
H (p (x)) = - \int p (x) \log p (x) d x = \mathbb {E} [ - \log p (x) ]. \tag {1}
$$
The differential entropy is in  $[- \infty, \infty]$  for continuous random variables. It is a measure of uncertainty in the random variable in the sense that its minimum is achieved when there is no uncertainty in the random vector, i.e., a Dirac delta, and approaches the maximum as the density becomes uniformly distributed.
Gaussian mixtures are ubiquitous in statistics and machine learning due to their property as universal density approximators [18]. However, despite this flexibility, the entropy of a Gaussian mixture requires computing the expectation of the log-sum operator, which lacks a closed form. Many approximations and bounds are used in practice. A simple upper bound is given by the entropy of a single Gaussian with the same mean and covariance as the mixture [14], and a lower bound can be obtained by Jensen's inequality. Though efficient, these bounds are very loose in practice, leading to more accurate methods being used, such as various Monte Carlo approximations, deterministic sampling [12], and numerous variational bounds and approximations [21, 10].
2.2 Taylor Polynomials
In this paper we explore entropy approximation using Taylor polynomials. The  $n^{th}$ -order Taylor polynomial of a function  $f(x)$  with evaluation point  $c$  is given by,
$$
T _ {f, n, c} (x) = \sum_ {i = 0} ^ {n} \frac {f ^ {(n)} (c)}{n !} (x - c) ^ {n}, \tag {2}
$$
where  $f^{(n)}(c)$  denotes the  $n^{\text{th}}$  derivative of  $f$  evaluated at point  $c$ . The Taylor series has a region of convergence which determines the range of x-values where the series accurately represents the original function. It depends on the behavior of the function and its derivatives at the expansion point. Analyzing the region of convergence is crucial for ensuring the validity of the Taylor series approximation. Various convergence tests, such as the ratio test, help determine the x-values where the Taylor series provides an accurate approximation.
2.3 Orthogonal Polynomials
Taylor series are versatile approximations, however predominately behave well near the center point chosen. We ideally would like an approximation that performs well across a range of values. To achieve this, we consider series approximation via orthogonal polynomials. A set of orthogonal polynomials on the range  $[a,b]$  is an infinite sequence of polynomials  $P_0(x), P_1(x), \ldots$  where  $P_n(x)$  is an  $n^{th}$  degree polynomial and for any pair of polynomials satisfies
$$
\langle P _ {i} (x), P _ {j} (x) \rangle = \int_ {a} ^ {b} P _ {i} (x) P _ {j} (x) d x = c _ {i} \delta_ {i j} \tag {3}
$$
where  $\delta_{ij}$  is the Kronecker delta function and  $c_{i}$  is some constant. Orthogonal polynomials can be used to approximate a function,  $f(x)$ , on their interval,  $[a,b]$ , by finding the projection of  $f(x)$  onto each polynomial in the series  $P_{i}(x)$ .
$$
f (x) = \sum_ {i = 1} ^ {\infty} \frac {\langle f (x) , P _ {i} (x) \rangle}{\langle P _ {i} (x) , P _ {i} (x) \rangle} P _ {i} (x) \tag {4}
$$
Any appropriate choice of orthogonal polynomials can be used. One might be interested in considering the Chebyshev polynomials for their property of minimizing interpolation error or Legendre polynomials for their versatility and ease of computation.
3 Convergence of Polynomial Approximations
To estimate the entropy  $H(p) = \mathbb{E}_p[-\log (p(x))]$  using a polynomial approximation one may approximate either the log-density  $\log (p(x))$  or just the logarithm  $\log (y)$ . We will show that estimating  $\log (p(x))$  has convergence issues and that it can be complicated to compute due to tensor arithmetic in higher dimensions. Both of these issues will be addressed by simply approximating  $\log (y)$  and computing the exact  $p(x)$ . All proofs are deferred to the Appendix for space.
3.1 Divergence of Huber et al. Approximation
We begin our exploration with a widely used approximation of the GMM entropy due to [15]. Let  $p(x)$  be a GMM and the log-GMM  $h(x) = \log(p(x))$ . Huber et al. provides a Taylor series approximation of the GMM entropy given by,
$$
\log (p (x)) = - \sum_ {i = 1} ^ {M} w _ {i} \sum_ {n = 0} ^ {\infty} \frac {h ^ {(n)} (\mu_ {i})}{n !} (x - \mu_ {i}) ^ {n}, \tag {5}
$$
The series is  $M$  individual Taylor series evaluated at each component mean,  $\mu_{i}$ . The equality in Eqn. (5) only holds if the series converges, which we will show is not the case in general.
Theorem 3.1 (Divergence Criterion for Huber et al.). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x \mid \mu_i, \Sigma_i)$  and consider the Taylor series presented in Eqn. (5). If any mean component,  $\mu_i$ , satisfies the condition  $p(\mu_i) < \frac{1}{2} \max(p(x))$ , then the series diverges, otherwise it converges.
Theorem 3.1 provides us with the condition that Huber et al.'s approximation Eqn. (5) will diverge. This means that the entropy approximation will be inaccurate for any GMM with any of its modes less than half the probability of any other point, as illustrated in Fig. 1.
3.2 Taylor Series Approximation of the Logarithm
Motivated by the divergence of the previous Taylor series we propose a different approach that is provably convergent. While Huber et al. perform a Taylor decomposition of the log-GMM PDF, our approach decomposes only the  $\log (y)$  function using a Taylor series of the function centered about the point  $a$ . It is well-known that this series converges for values  $|y - a| < a$  [28] and is given by,
$$
\log (y) = \log (a) + \sum_ {n = 1} ^ {\infty} \frac {(- 1) ^ {n}}{n a ^ {n}} (y - a) ^ {n}. \tag {6}
$$
Note the change of  $c$  to  $a$  as the Taylor series center. This change highlights the difference in function domains. In particular, the former series is computed on values of the random vector  $x$ , whereas ours is computed on the PDF  $y = p(x)$ . Choosing any center  $a > \frac{1}{2} \max(p(x))$  will ensure that the series converges everywhere.
Figure 1: Divergence of Huber et al. and convergence of our polynomial series approximation are plotted for the Gaussian mixture,  $p(x) = .35\mathcal{N}(x \mid -3,2) + .65\mathcal{N}(x \mid 0,.2)$ . In the left graph, the log-GMM is plotted, which is what each series is defined for. The right plot is the exponential of the series so we can see how each converge in the more familiar framework of a GMM. Notice that the Huber et al. is centered on the first component mean  $\mu_{1} = -3$  and diverges around the mean of the second component  $\mu_{2} = 0$  as supported by Theorem 3.1 since the mode  $\mu_{1}$  is less than half the probability at the mode  $\mu_{2}$ . Both of our methods are convergent, the Taylor series is a bound (Theorem 4.3) while the Legendre series has a lower global error.
Lemma 3.2 (Convergent Taylor Series of Log). If  $a > \frac{1}{2} \max(p(x))$ , then for all  $x$
$$
\log (p (x)) = \log (a) + \sum_ {n = 1} ^ {\infty} \frac {(- 1) ^ {n - 1}}{n a ^ {n}} \sum_ {k = 0} ^ {n} \binom {n} {k} (- a) ^ {n - k} p (x) ^ {k} \tag {7}
$$
The proof of Lemma 3.2 is a simple ratio test. The only assumption on  $p(x)$  is that it has a finite maximum, which is true for any non-degenerate GMM with positive definite component covariances. As a result, the Taylor series converges for all  $x$  regardless of the GMM form.
3.3 Legendre Series Approximation of the Logarithm
For the orthogonal polynomial approximation, we consider the Legendre polynomials, specifically the shifted Legendre polynomials [4] which are orthogonal on  $[0,a]$ ,
$$
P _ {n} (y) = L _ {[ 0, a ], n} (y) = \sum_ {k = 0} ^ {n} \frac {(- 1) ^ {n + k} (n + k) !}{(n - k) ! (k !) ^ {2} a ^ {k}} y ^ {k} \tag {8}
$$
Lemma 3.3 (Convergent Legendre Series of Log). If  $a > \max(p(x))$ , and consider the shifted Legendre polynomials on the interval  $[0, a]$  in Eqn. (8). Then for  $x$  a.e.
$$
\log (p (x)) = \sum_ {n = 0} ^ {\infty} (2 n + 1) \sum_ {j = 0} ^ {n} \frac {(- 1) ^ {n + j} (n + j) ! ((j + 1) \log (a) - 1)}{(n - j) ! ((j + 1) !) ^ {2}} L _ {[ 0, a ], n} (p (x)) \tag {9}
$$
Again, all that is assumed about this approximation is that the max of a GMM can be bounded, so this approximation converges for all GMMs regardless of structure.
4 GMM Entropy Approximations
Having established multiple polynomial approximations in Sec. 3, we now consider applying them to the definition of entropy for a GMM. We can directly substitute the series approximation into the entropy definition,  $H(p(x)) = \mathbb{E}_p[-\log (p(x))]$ , and push the expectation through the summations.
4.1 Huber et al. Entropy approximation
Applying Huber et al.'s Taylor series approximation of the  $\log(p(x))$ , we see the GMM entropy can be approximated by,
$$
H (p (x)) = - \sum_ {i = 1} ^ {m} w _ {i} \sum_ {n = 0} ^ {\infty} \frac {h ^ {(n)} \left(\mu_ {i}\right)}{n !} \mathbb {E} _ {q _ {i}} \left[ (x - \mu_ {i}) ^ {n} \right], \tag {10}
$$
where  $q_{i}(x) = \mathcal{N}(x\mid \mu_{i},\Sigma_{i})$  is shorthand for the  $i^{\mathrm{th}}$  Gaussian component. The attractive feature of Eqn. (10) is that it simplifies the expected value of a log-GMM to the  $n^{\mathrm{th}}$  central moments of the  $i^{\mathrm{th}}$
component which, is exactly zero when  $n$  is odd and has a closed form when  $n$  is even. However, Theorem 3.1 shows that this approximation is not guaranteed to converge, which is supported by experimental results in Sec. 6. Furthermore, in higher dimensions,  $h^{(n)}(\mu_i) = \frac{\partial^n h(\mu_i)}{\partial x_1^{j_1} \cdots \partial x_d^{j_n}}$ , where  $j_1 + \cdots + j_d = n$  which grows rapidly, is an  $n$  dimensional tensor. This is cumbersome to compute and is difficult to deal with the tensor arithmetic required beyond a Hessian. In practice, this limits Eqn. (10) to only second order approximations for random vectors.
4.2 Taylor Series Entropy Approximation
Having established the convergent Taylor series of the logarithm in Lemma 3.2, we can apply the approximation and push the expectation through the summations. This reduces the computation of the entropy to computing  $\mathbb{E}_p[p(x)^k]$  for all  $k < n$  where  $n$  is the order of the polynomial approximation.
Lemma 4.1 (Closed form expectation of powers of GMMs). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x|\mu_i, \Sigma_i)$  be a GMM and  $k$  be a non-negative integer. Then
$$
\mathbb {E} _ {p} \left[ p (x) ^ {k} \right] = \sum_ {j _ {1} + \dots + j _ {M} = k} \binom {k} {j _ {1}, \dots , j _ {M}} \sum_ {i = 1} ^ {M} w _ {i} \left(\frac {\mathcal {N} \left(0 \mid \mu_ {i} , \Sigma_ {i}\right)}{\mathcal {N} \left(0 \mid \mu , \Sigma\right)} \prod_ {t = 1} ^ {M} \left(w _ {t} \mathcal {N} \left(0 \mid \mu_ {t}, \Sigma_ {t}\right) ^ {j _ {t}}\right)\right) \tag {11}
$$
where  $\Sigma = (\Sigma_{i}^{-1} + \sum_{t=1}^{M} j_{t} \Sigma_{t}^{-1})^{-1}$  and  $\mu = \Sigma (\Sigma_{i}^{-1} \mu_{i} + \sum_{t=1}^{M} j_{t} \Sigma_{t}^{-1} \mu_{t})$ .
While Eqn. (11) may seem complicated at first glance, it is straightforward to compute. All terms are Gaussian densities, polynomial functions, and binomial coefficients. Lemma 4.1 is defined for  $\mathbb{E}_p[p(x)^k]$  but an analogous definition holds for  $\mathbb{E}_p[q(x)^k]$  allowing us to apply all the following results not only to entropy, but cross-entropy, KL and MI of GMMs. This is not the focus of this paper, however a discussion can be found in A.4 for completeness. Using Lemma 3.2 and Eqn. (11), we can obtain the following approximation,
$$
\hat {H} _ {N, a} ^ {T} (p (x)) = - \log (a) - \sum_ {n = 1} ^ {N} \frac {(- 1) ^ {n - 1}}{n a ^ {n}} \sum_ {k = 0} ^ {n} \binom {n} {k} (- a) ^ {n - k} \mathbb {E} _ {p} [ p (x) ^ {k} ] \tag {12}
$$
To ensure the expected value can be pushed through the infinite sum of the series, we check that our finite order entropy approximation does still converge to the true entropy.
Theorem 4.2 (Convergence of  $\hat{H}_{N,a}^T(p(x))$ ). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x|\mu_i, \Sigma_i)$  be a GMM and choose a Taylor center such that  $a > \frac{1}{2} \max(p(x))$ . Then, for  $\hat{H}_{N,a}^T(p(x))$  defined in Eqn. (12)
$$
\lim  _ {N \rightarrow \infty} \hat {H} _ {N, a} ^ {T} (p (x)) = H (p (x)) \tag {13}
$$
Having established convergence of our estimator, it remains to provide a method for selecting a Taylor center that meets the convergence criterion  $a > \frac{1}{2}\max (p(x))$ . In fact, we show in Theorem 4.3 that selecting a looser condition  $a > \max (p(x))$  ensures convergence from below, thus yielding a lower bound on the true entropy.
Theorem 4.3 (Taylor Series is Lower Bound of Entropy). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x|\mu_i, \Sigma_i)$  and  $a > \max(p(x))$ . Then, for all finite  $N$ ,
$$
\hat {H} _ {N, a} ^ {T} (p (x)) \leq H (p (x)) \tag {14}
$$
We have now established that the Taylor center chosen as  $a > \max(p(x))$  is both convergent and yields a lower bound. In fact, it is easy to find such a point by upper bounding the maximum of a GMM as given in Theorem 4.4.
Theorem 4.4 (Upper bound on maximum of a GMM). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x | \mu_i, \Sigma_i)$ , then
$$
\max  (p (x)) \leq a = \sum_ {i} ^ {M} w _ {i} \left| 2 \pi \Sigma_ {i} \right| ^ {- \frac {1}{2}} \tag {15}
$$
In our experience choosing a center closer to the convergence criterion  $a > \frac{1}{2}\max(p(x))$  yields slightly more accurate estimates, but not significantly so.
4.3 Legendre Entropy Approximation
Now, starting with the convergent Legendre approximation considered in Lemma 3.3 and Eqn. (11), we can obtain the following approximation,
$$
\hat {H} _ {N, a} ^ {L} (p (x)) = - \sum_ {n = 0} ^ {N} (2 n + 1) \sum_ {j = 0} ^ {n} \frac {(- 1) ^ {n + j} (n + j) ! ((j + 1) \log (a) - 1)}{(n - j) ! ((j + 1) !) ^ {2}} L _ {[ 0, a ], n} \left(\mathbb {E} _ {p} [ p (x) ^ {k} ]\right) \tag {16}
$$
Again, we verify that taking the expectation of our series does not effect convergence.
Theorem 4.5 (Convergence of  $\hat{H}_{N,a}^{L}(p(x))$ ). Let  $p(x) = \sum_{i=1}^{M} w_i \mathcal{N}(x|\mu_i, \Sigma_i)$  be a GMM and choose an interval such that  $a > \max(p(x))$ . Then for  $\hat{H}_{N,a}^{L}(p(x))$  defined in Eqn. (16)
$$
\lim  _ {N \rightarrow \infty} \hat {H} _ {N, a} ^ {L} (p (x)) = H (p (x)) \tag {17}
$$
Now having established converge criterion for the Legendre series approximation, we need to choose an upper point of the interval for the Legendre series. We need to choose  $a > \max(p(x))$  which is satisfied by the same  $a$  found in Lemma 4.4.
4.4 Approximation of Taylor Series Limit
Computing the series in Eqn. (12) for higher orders can be computationally prohibitive. In particular, the sum  $\sum_{j_1 + \ldots + j_M = n}$  is over  $M$  integers summing to  $n$ , which is  $\mathcal{O}((n + M - 1)!)$ . In this section, we provide an approximation that avoids explicit computation of this sum for higher orders. We employ a method (similar to Richardson extrapolation [22]) that is based on a polynomial fit of the convergence rate for the lower bound property discussed in Theorem 4.3. From Taylor's theorem, we know that a function can be represented as  $f = T_n + R_n$ , where  $T_n$  is the  $n^{th}$  order Taylor polynomial and  $R_n = \mathcal{O}(\alpha^n)$  is the remainder. Rewriting this in terms of the Taylor polynomial, we observe that  $T_n = -R_n + f = \beta \alpha^n + \eta$ . We take  $\beta < 0$  to represent the negative scale factor in front of the remainder, and  $0 < \alpha < 1$  to model the decay of the remainder.
$$
\hat {H} _ {n, a} ^ {T} (p (x)) = \beta \cdot \alpha^ {n} + \eta \tag {18}
$$
We require three consecutive orders of our Taylor series approximation,  $\hat{H}_{n,a}^{T}(p(x)),\hat{H}_{n + 1,a}^{T}(p(x))$  and  $\hat{H}_{n + 2,a}^T (p(x))$ , to solve for the three unknown parameters:
$$
\hat {H} _ {n, a} ^ {T} (p (x)) = \beta \cdot \alpha^ {n} + \eta
$$
$$
\hat {H} _ {n + 1, a} ^ {T} (p (x)) = \beta \cdot \alpha^ {n + 1} + \eta
$$
$$
\hat {H} _ {n + 2, a} ^ {T} (p (x)) = \beta \cdot \alpha^ {n + 2} + \eta .
$$
Since  $0 < \alpha < 1$ ,  $\lim_{n\to \infty}\beta \alpha^n = 0$ , indicating that we aim to solve for  $\eta$  as our approximation of the limit of the Taylor series entropy.
$$
\hat {H} _ {N, a} ^ {T L} (p (x)) = \eta = \hat {H} _ {N - 2, a} ^ {T} (p (x)) - \frac {\left(\hat {H} _ {N - 1 , a} ^ {T} (p (x)) - \hat {H} _ {N - 2 , a} ^ {T} (p (x))\right) ^ {2}}{\hat {H} _ {N , a} ^ {T} (p (x)) - 2 \hat {H} _ {N - 1 , a} ^ {T} (p (x)) + \hat {H} _ {N - 2 , a} ^ {T} (p (x))} \tag {19}
$$
This approach assumes that the Taylor series converges according to Eqn. (18), which is not the case in general. Identifying the exact rate of convergence is a topic of future work. Nevertheless, this simple approximation has shown higher accuracy in practice with negligible additional computation, as demonstrated in the experiments of Sec. 6. With a slight abuse of terminology, we refer to this approach as the Taylor limit. We do not apply this method to the Legendre approximation (Eqn. (16)) as it doesn't maintain a lower bound during its convergence. Although equivalent methods have been considered to model potential oscillation convergence, in practice, we do not find an increase in accuracy.
Numerous approximation methods exist in the literature for estimating entropy and related information measures, such as mutual information and Kullback-Leibler divergence, in the context of Gaussian Mixture Models (GMMs). Monte Carlo estimation, deterministic bounds using Jensen's inequality,
Figure 2: Scalar GMM example is plotted on the left. The variance of a component of a two component GMM is varied between  $\sigma_2^2 \in (0,1]$  as in theory according to Theorem 3.1, the example will be divergent where  $\sigma_2^2 < .46$  and convergent above. We plot the fourth order of each method and see that Huber et al.'s approximation does diverge where the theory predicts. Two dimensional GMM with five components is considered on the right. Here the mean of a single component is shifted from  $\mu_5 = [-3, -3]^T$  to  $\mu_5 = [3,3]^T$ . We consider the third order approximation of each method and see that Huber et al. is poorly behaved. In both examples, we see that our Taylor method is a lower bound (Theorem 4.3), the Taylor limit provides higher accuracy, and Our Legendre method is a highly accurate approximate.