Unit 2: Infinite Series
Chapter 10: Fourier Series
Sections10.6: optimizing property of Fourier series
Copyright
Copyright * 2001 by Addison Wesley Longman, Inc.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.
Initializations
> restart;
>
with(plots):
with(plottools):
with(student):
Warning, the name changecoords has been redefined
> read(`C:/Program Files/Maple 6.01/pvac.txt`):
Approximating
via Trigonometric Polynomials
A partial sum of a Fourier series is a trigonometric polynomial approximating the function to which the series converges. For the function
> f := x;
>
defined on the interval
, a two-term trigonometric polynomial which might approximate it is
> g := s1*sin(x) + s2*sin(2*x);
>
Judging the quality of the approximation of
by
requires a measure of the goodness of the fit of
to
. In Sections8.4 we used the notion of convergence in the mean to measure convergence of a sequence of functions. The measure of performance for our trigonometric approximation will be
the square of the measure used for convergence in the mean. The
subscript
2 indicates that the difference between
and
in the integral has been
squared
.
We illustrate this measure in the following example.
>
Example 10.12
Assigning
and
the values 1 in
yields the approximating
> g1 := subs(s1=1, s2=1, g);
>
appearing in the following figure, Figure 10.27, as the solid (red) curve. The dashed (black) curve is, of course,
.
> plot([f,g1],x=0..Pi,color=black,linestyle=[2,1], color=[black,red], xtickmarks=3, ytickmarks=3, labels=[x,``], labelfont=[TIMES,ITALIC,12]);
>
The calibre of
as an approximation to
is captured in the following animation.
>
F := plot([f,g1], x=0..Pi, color=[black,red], thickness=3):
fx := unapply(f,x):
gx := unapply(g1,x):
F1 := t -> display(polygon([[t,gx(t)],[ t,fx(t)], [t+.1,fx(t+.1)], [t+.1,gx(t+.1)]], color=green)):
F2 := N -> display([seq(F1(k/10),k=0..N)]):
F3 := display([seq(F2(k),k=0..31)],insequence=true):
display([F,F3], labels=[x,y], labelfont=[TIMES,ITALIC,12], xtickmarks=3, ytickmarks=3);
>
The integral of the square of the difference between
and
varies with the total area between the two curves. The green area swept in the animation above quantifies the fit. The integral "measures" the amount of green. The less "green," the better the fit between the two functions. Hence, minimizing the amount of green area yields the "best" fit according to the constraints of this particular method of measuring fit.
A calculation shows
=
since the value of
> q := Int((f-g1)^2,x=0..Pi);
>
evaluates to
> value(q) = evalf(value(q));
>
Optimizing the Fit Heuristically
For our example, the measure of fit between
and
would be
> q := Int((f-g)^2,x=0..Pi);
>
with value
> Q := value(q);
>
a function of the two parameters
and
, graphed in Figure 10.28, below.
>
p1:=plot3d(Q,s1=1..3, s2=-2..0, axes=boxed, style=patchcontour, labels=[`s1 `,` s2`,`Q `], labelfont=[TIMES,ITALIC,12], tickmarks=[3,3,3], scaling=constrained, orientation=[-45,65]):
p2:=spacecurve([[1,-2,2.5],[1,0,2.5],[3,0,2.5]],color=black, linestyle=2):
display([p1,p2]);
>
The surface determined by
has a minimum point near (
) =
which we will momentarily find by the analytic techniques of calculus.
First, however, we build the following Maple procedure which accepts a guess for the pair of parameters (
) and plots both
and the resulting approximating curve
. In addition, the value of the measuring integral is computed and displayed.
>
a := proc(u,v)
local G,h,p1,p2;
G := subs(s1=u,s2=v,g);
h := evalf(subs(s1=u,s2=v,Q));
p1 := plot([f,G],x=0..Pi, color=[black,red]):
p2 := textplot([1,3,convert(h,string)]):
display([p1,p2]);
end:
>
For example, the approximating function
> g1;
>
has
and
, so we try
> a(1,1);
>
and
> a(1,.5);
>
The reader is encourages to continue experimenting until a minimizing point is found empirically.
>
Optimizing the Fit Analytically
Equating to zero the partial derivatives of
taken with respect to
and
yields the equations
>
eq1 := diff(Q,s1) = 0;
eq2 := diff(Q,s2) = 0;
>
whose solution is (
) =
, determined in Maple by
> qq := solve({eq1,eq2},{s1,s2});
>
Hence, the best fit to
which we can obtain under this measure, using the fitting function
is the function
> G := subs(qq,g);
>
graphed (as the red curve) in Figure 10.29 (below)
> plot([x,G],x=0..Pi, color=[black,red], linestyle=[2,1], xtickmarks=3, ytickmarks=3, labels=[x,``],labelfont=[TIMES,ITALIC,12]);
>
for which we have
, as determined by
> a(2,-1);
>
Best Fit, Generalized
We next seek, for a general function
on the interval
, the best approximating trigonometric polynomial of the form
To minimize the measure of performance
solve the normal equations
= 0,
for
. Because the integrals of the "cross terms" vanish, that is, because
for
these equations take the form
=
from which we determine
These values for the
are precisely the coefficients of the Fourier sine series for
on the interval
. The Fourier series is the best trigonometric approximation to
, provided the measure used to determine "best" is convergence in the mean.
Insight into the calculations on which this derivation is based can be obtained by working with the finite approximating sum
> g := add(s[k]*sin(k*x),k=1..5);
>
Restoring
to the status of a free variable via
> f:='f';
>
we write the measure of performance as
and enter into Maple as it
> Q := Int((f(x)-g)^2,x=0..Pi);
>
To minimize this measure of performance, differentiate with respect to each
, setting each derivative to zero. The general term for such derivatives will be of the form
If the integrations are carried out, the surviving terms will be of the form
because, for
, integrals of the form
all vanish. Indeed, in Maple we have
>
for n from 1 to 5 do
for m from 1 to n-1 do
print(Int(sin(n*x)*sin(m*x),x=0..Pi) = int(sin(n*x)*sin(m*x),x=0..Pi));
od;od;
>
On the other hand, integrals of the form
are not zero. In fact, using Maple, we find
>
for k from 1 to 5 do
Int(sin(k*x)^2,x=0..Pi) = int(sin(k*x)^2,x=0..Pi);
od;
>
Incidentally, more than thirty years ago, Tom Hack, a fellow graduate student at Purdue University, pointed out that one could remember the value of such integrals by observing
=
, and apportioning "half" the contribution to the sine term and "half" to the cosine term. (Recounting this to students since, yields laughter, but correct answers!)
Thus, the equations obtained by differentiating can be evaluated to the forms below.
>
for k from 1 to 5 do
q||k := value(expand(diff(Q,s[k]),sin)) = 0;
od;
>
Solving each equation yields one coefficient each because the integrations eliminate all "cross terms." The vanishing of such cross terms is special to the set of functions
, and is the reason why such functions are used to make Fourier series.
>
for k from 1 to 5 do
isolate(q||k,s[k]);
od;
>
These values for the
are precisely the Fourier sine series coefficients for the interval
. The Fourier series is the best trigonometric approximation to
, provided the measure used to determine "best" is convergence in the mean.
There are other functions with the same minimizing property, the essence of which is the vanishing of the integrals of the "cross terms." This property is called "orthogonality" in the literature, and is the basis for generalizations of the Fourier series. In the next lesson, we will obtain the Fourier-Legendre series, and similar techniques could be used to obtain series of Bessel functions, Tchebychev polynomials, Laguerre polynomials, Hermite polynomials, and many other of the special functions of applied mathematics.
>
Orthogonality of Functions
A key step in obtaining the Fourier coefficients by minimizing the mean-square norm
is the vanishing of the "cross-terms," the integrals
This leads to a general definition of the orthogonality of functions.
>
Definition 10.1
Two functions
and
are said to be orthogonal on the interval
if
There are functions other than just sines and cosines with the same orthogonal, "minimizing" property, the basis for generalizations of the Fourier series. In Sections10.7, we will use orthogonality to obtain the Fourier-Legendre series, and in Sections16.2 we will again use orthogonality to obtain the Fourier-Bessel series. Similar techniques could be used to obtain series of Chebyshev polynomials, Laguerre polynomials, Hermite polynomials, and many other of the special functions of applied mathematics.
>
Additional Remark about Orthogonality
The student is cautioned against a search for a "geometric" orthogonality in this definition. Functions orthogonal under this definition will not "look" perpendicular in any way. The definition is merely a generalization of the notion of orthogonality of vectors under the usual dot product, as learned in the standard multivariable calculus course.
The functions
>
f := sin(x);
g := sin(3*x);
>
have been shown, in the previous lesson, to be orthogonal on the interval
. Indeed,
> Int(f*g,x=0..Pi) = int(f*g,x=0..Pi);
>
The functions don't "look" orthogonal, as seen in the following graph.
> plot([f,g],x=0..Pi, color=black, linestyle=[1,2], scaling=constrained);
>
Lest the student misinterpret the figure and mistakenly conclude that the two "orthogonal" functions cross at right angles, we compute the points of intersection, and compute the slopes of the curves at one of the intersections. If the curves were geometrically orthogonal at this point, the product of their slopes would be
. Hence,
> solve(f=g,x);
>
and
> simplify(subs(x=Pi/4,diff(f,x)*diff(g,x)));
>
Clearly, these orthogonal curves do not cross at right angles. Moreover, orthogonality of the curves in an interval property. If the interval were changed, the curves might no longer be orthogonal under this definition. For instance, if the interval be changed to
, we would have
> Int(f*g,x=0..Pi/4) = int(f*g,x=0..Pi/4);
>
and the same functions would no longer be considered orthogonal.
>