1.8 Numerical Determination of Fourier Coefficients 103
Ifris odd, Eqs. (3) and (4) are valid forn= 1 , 2 ,...,(r− 1 )/2, giving a total of
rcoefficients. Ifris even, Eq. (4) givesbˆr/ 2 =0, and Eq. (3) has to be modified:
aˆr/ 2 =^1
r(
f(x 1 )cos(rπx
1
2 a)
+···+f(xr)cos(rπx
r
2 a))
. (3′)
We again getrvalid coefficients.
The formulas in Eqs. (2)–(4) were derived for the case in whichx 0 ,x 1 ,...,xr
are equally spaced points in the interval−a≤x≤a. However, they remain
valid for equally spaced points on the interval 0≤x≤ 2 a.Thatis,
x 0 = 0 , x 1 =2 a
r, x^2 =4 a
r, ..., xr=^2 a. (5)
Note also that whenf(x)is given in the interval 0≤x≤aand the sine or co-
sine coefficients are to be determined, the formulas may be derived from those
already given here. Let the interval be divided intosequal subintervals with
endpoints 0=x 0 ,x 1 ,...,xs=a(in general,xi=ia/s). Then the approximate
Fourier cosine coefficients forfor its even extension are
aˆ 0 =1
s( 1
2 f(x^0 )+f(x^1 )+···+f(xs−^1 )+1
2 f(xs))
,
aˆn=2
s( 1
2 f(x^0 )+f(x^1 )cos(nπx
1
a)
+···+
1
2 f(xs)cos(nπx
s
a))
,
n= 1 ,...,s− 1 ,aˆs=1
s( 1
2 f(x^0 )+f(x^1 )cos(sπx
1
a)
+···+
1
2 f(xs)cos(sπx
s
a))
. (6)
Similarly, the approximate Fourier sine coefficients forfor its odd extension
are
bˆn=^2
s(
f(x 1 )sin(nπx
1
a)
+···+f(xs− 1 )sin(nπx
s− 1
a))
,
n= 1 , 2 ,...,s. (7)
An important feature of the approximate Fourier coefficients is this: IfF(x)=ˆa 0 +ˆa 1 cos(πx
a)
+ˆb 1 sin(πx
a)
+···
is a finite Fourier series using a total ofrapproximate coefficients calculated
from Eqs. (3) and (4), thenF(x)actuallyinterpolatesthe functionf(x)at
x 1 ,x 2 ,...,xr.Thatis,
F(xi)=f(xi), i= 1 , 2 ,...,r.