|
Software: |
Suppose we have a one-variable function f(x)
whose values are known at points which may be unevenly spaced:
Nx where the Ai's are constants and Nx+1 is the number of terms in x. For an exact fit, Nx=Px, otherwise Nx<Px. If we use xC as center of expansion, the approximating function's value at the mth grid point is: Nx To do an exact fit, at each grid point we equate the value of the function at that grid point to the value of the approximation at the same grid point:
Nx This way we set up a system of linear equations from which the coefficients Ai can be easily found. If we have a 2-variable tabulated function f(x,y) whose values are known at the grid points of a rectangular grid which may be unevenly spaced, such as
which has Px intervals in the x-direction and Py intervals in the y-direction, we can approximate the function by a linear combination of the first Nx+1 and Ny+1 members of certain complete sets of functions {Gi} and {Hj} using a series expansion of the form: Nx
Ny which has Nx+1 terms in x and Ny+1 terms in y. For an exact fit, Nx=Px and Ny=Py, otherwise Nx<Px and/or Ny<Py. If we use (xC,yC) as center of expansion, the approximating function's value at the (xm,yn) grid point is: Nx
Ny To do an exact fit, at each grid point we equate the value of the function at that grid point to the value of the approximation at the same grid point:
Nx
Ny This way we set up a system of linear equations from which the coefficients Aij can be easily found. Extension to more than 2 variables is obvious. The sets of functions used here, that is, {Gi} and {Hj}, are: 1, (x-xC), (x-xC)2, (x-xC)3, (x-xC)4,... and 2p(x-xC)
2p(x-xC)
2*2p(x-xC)
2*2p(x-xC) where xC is the center of expansion and PER is the period. The use of finite power and trigonometric series is partly justified by Weierstrass' Approximation Theorems: 1) Any function which is continuous in an interval may be approximated in that interval, to any degree of accuracy, by a finite power series. 2) Any continuous periodic function may be approximated, to any degree of accuracy, by a finite trigonometric series. Naturally, if the function itself is not a finite power or trigonometric series, then we need more and more terms for more and more accuracy. A power or trigonometric series with infinite number of terms may yield the exact value of the function, as is the case with Taylor and Fourier series. Developing a Fourier or Taylor series, however, may not be very easy. A Fourier series requires the evaluation of the Fourier Coefficients, which are integrals which in turn may need numerical evaluation. A Taylor expansion requires you to find all the function's derivatives and this may be a difficult task. (Curiously, continuous nondifferentiable functions exist, that is, there are continuous curves with no tangent at any point.) Thus, the Weierstrass' Theorems make this approach acceptable if the solution is known to be continuous in the interval of interest. If necessary, the problem should be solved piecewise, each time choosing an interval in which the solution and its derivatives are known to be continuous and sufficiently smooth (with a limited number of wiggles). |
|
Copyright © 2001-2010 Numerical Mathematics. All rights reserved.
|