Generating Efficient Numerical Evaluation Routines for Bivariate Functions via Tensor Product Series
Keith O. Geddes
Symbolic Computation Group
David R. Cheriton School of Computer Science
University of Waterloo, Waterloo, Ontario N2L 3G1 Canada
Joint work with Frederick W. Chapman and Xiang Wang
Abstract
Given a bivariate function we consider the problem of generating, in an automated manner, a routine for efficient numerical evaluation at any point in a specified rectangular region of the - plane. The goals for the generated routine are: accuracy (for a specified fixed precision), efficiency, and the generated routine must be "purely numerical" in the sense that it can be translated into a language such as C and can be compiled for inclusion in a numerical library. For example, we are able to generate numerical evaluation routines for the various Bessel functions (with the order treated as a real-valued variable), and other bivariate functions, with significantly increased speed of evaluation compared with current implementations.
We exploit the capabilities of a computer algebra system to achieve the desired level of automation. A fundamental tool in our method is the natural tensor product series developed in a doctoral thesis by Frederick W. Chapman in 2003. Using this technique, is approximated by an interpolation series such that each term in the series is a tensor product . The efficiency of approximation achieved by this method derives from the fact that the univariate basis functions are cross-sections of the original bivariate function. The bivariate approximation problem is thereby reduced to a sequence of univariate approximation problems which can be handled by various well-known techniques. Assuming that the univariate basis functions are analytic with isolated singularities, we apply singularity-handling techniques to ensure the efficiency of the univariate approximations.
Hybrid Symbolic-Numeric Integration (1-D)
Example 2.1: Series expansion at a singularity
> |
(2.1.1) |
> |
> |
Form the integral on and apply numerical integration.
> |
(2.1.2) |
> |
(2.1.3) |
Evaluating numerically to 25 digits yields the following result.
> |
(2.1.4) |
Note that the integrand has a logarithmic singularity at x=0 as the following series expansion shows.
> |
(2.1.5) |
The hybrid symbolic-numeric technique (automated in Maple) includes the concept of term-by-term integration of such a series expansion, employing symbolic integration for the individual terms.
> |
Example 2.2: Subtracting off a singularity
> |
> |
(2.2.1) |
> |
(2.2.2) |
> |
Note that the graph of this integrand goes to at . However, this is an integrable singularity. It behaves like near .
> |
> |
Note: The technique of subtracting off a singularity illustrated below, takes place automatically within Maple's numerical integration routines.
Suppose it is desired to compute the result to 25 digits of accuracy.
> |
(2.2.3) |
The generalized series expansion of at takes the following form.
> |
(2.2.4) |
The non-regular part is
> |
(2.2.5) |
The new expression
> |
(2.2.6) |
is analytic on the interval [0, 1]. Thus it can be integrated easily by the default numerical integration method.
> |
(2.2.7) |
> |
(2.2.8) |
> |
Integrating is easy because it has the indefinite integral
> |
(2.2.9) |
and its definite integral can therefore be computed symbolically.
> |
(2.2.10) |
Finally, summing the two values, we obtain the value for the original definite integration problem.
> |
(2.2.11) |
> |
Example 2.3: Algebraic transformation of variables
> |
> |
(2.3.1) |
> |
(2.3.2) |
Note: The change of variables illustrated below takes place automatically within Maple's numerical integration routines.
The generalized series expansion of at is of the form
> |
(2.3.3) |
Applying the change of variables (i.e., ) yields
> |
(2.3.4) |
> |
The new integrand is analytic on the interval of integration.
Thus it can be integrated easily by the default numerical integration method, even at high accuracy.
Suppose that the result is desired to 50 digits of accuracy.
> |
(2.3.5) |
> |
Introduction to Tensor Product Series
The main tool for generating approximations of bivariate functions will be tensor product series. The key concept is interpolation of bivariate functions by what is known as a natural tensor product [Thomas76]. The Ph.D thesis by Chapman [Chapman03] developed the theory of tensor product series and we presented an ISSAC'05 paper [CarvajalChapmanGeddes05] which applied the theory to develop a hybrid symbolic-numeric method for the calculation of multidimensional integrals.
In our ISSAC'05 paper, we restricted attention to the case of symmetric functions which was sufficient for the application to multidimensional integration. We have now extended the method to an efficient implemention of tensor product interpolation for general non-symmetric functions. The Masters thesis by Xiang (Sophy) Wang [Wang08] presented results of applying this technique to the generation of numerical evaluation routines for bivariate functions.
Tensor Products
The Splitting Operator
Tensor Product Series Expansions (a la Newton Interpolation Series)
Algorithm NTPS
Example 3.1
Consider the following symmetric function on :
The Geddes-Newton series to 3 terms is as follows, where the splitting points are for :
where
Observations
Convergence of the Series (Informal)
A Brief Glance at a Proof Technique
|
Linear Algebra Formulation of Tensor Product Series
where are real-valued constants, and is the splitting point used in the iteration.
where
Example 4.1
The tensor product series of rank generated in Example 3.1 for the symmetric function is represented in the following matrix-vector form.
(4.1.1) |
(4.1.2) |
(4.1.3) |
(4.1.4) |
(4.1.5) |
(4.1.6) |
(4.1.7) |
Since is a symmetric function, we see that the vector is the same as with replaced by and the matrix is simply the transpose of .
With the above definitions for the matrices and vectors, the tensor product series of Example 3.1 is as follows where, for illustration, we show and as well as .
Rank 1 approximation:
(4.1.8) |
Rank 2 approximation:
(4.1.9) |
Rank 3 approximation:
(4.1.10) |
Note: The size of the expressions representing tensor product approximations grows exponentially as the number of terms increases, if we form the explicit expressions. However, by maintaining the representation in matrix-vector form we avoid this expression growth. In our applications, the expressions in and (which appear only in the vectors and ) will be evaluated to numerical values before performing the matrix-vector multiplications.
Special case: Symmetric functions
As discussed in our ISSAC'05 paper, it is worth treating the case of symmetric functions specially. We note the following properties.
where
Benefits of the matrix-vector representation
Application to Multidimensional Integration
.
Transformation to a Canonical 2-D Integral
using the change of variables:
;
.
;
.
Example 5.1
Consider the double integral
Applying the change of variables to transform to the unit square, and then applying symmetrization, yields the new problem:
where
Result of computation:
Computational Results in 2-D
The results in the following table are for the 2-D integral:
Tol |
Time |
Result |
Pts |
RelErr |
|
0.3 |
0.069551393139 |
15 |
|
|
3.7 |
0.06955139313890799 |
21 |
|
|
5.3 |
0.0695513931389079901727 |
26 |
|
|
7.2 |
0.069551393138907990172712980 |
33 |
|
|
14.2 |
0.06955139313890799017271297964487 |
38 |
|
Integration in High Dimensions: A Brief Summary
Bivariate Functions: The need for increased evaluation speed
Example 6.1: Potential SpeedUp for a Bessel function
Consider , the Bessel function of the second kind.
(6.1.1) |