Inner Product Spaces

advertisement
Math 2270-2
Solution Template, part B
Due 2pm Friday March 26, 2004 (Nancy’s office is LCB 333)
Inner Product Spaces
> restart:with(plots):
Warning, the name changecoords has been redefined
1) Using the "dot1" inner product, find an orthonormal basis for P3 = span{1, t, t^2, t^3}.
> dot1:=(f,g)->int(f(t)*g(t),t=-1..1);
mag1:=f->sqrt(dot1(f,f)):
dist1:=(f,g)->mag1(f-g):
cosangle1:=(f,g)->(dot1(f,g)/(mag1(f)*mag1(g))):
fangle1:=(f,g)->evalf(arccos(cosangle1(f,g))):
1
⌠
dot1 := (f, g ) →  f(t ) g(t ) dt
⌡
-1
> P0:=t->1:
P1:=t->t:
P2:=t->t^2:
P3:=t->t^3:
> W0:=P0/mag1(P0):
> Z1:=P1-dot1(P1,W0)*W0:
W1:=Z1/mag1(Z1):
> Z2:=P2-dot1(P2,W0)*W0-dot1(P2,W1)*W1:
W2:=Z2/mag1(Z2):
> Z3:=P3-dot1(P3,W0)*W0-dot1(P3,W1)*W1-dot1(P3,W2)*W2:
W3:=Z3/mag1(Z3):
> W0(t); W1(t); W2(t); W3(t);
2
2
t 6
2

1
3  t 2 −  10

3
4

3 
5  t 3 − t  14

5 
4
2) Find the projection of f(t)=sin(t) onto P3.
> proj3:=f->evalf(dot1(f,W0)*W0+dot1(f,W1)*W1+dot1(f,W2)*W2+dot1(f,W
3)*W3):
> f:=t->sin(t);
g:=t->proj3(f)(t);
f := sin
g := 0.9980751086 P1 − 0.1576151192 P3
3) Compare the distance between sin(t) and its projection onto P3, to the distance between sin(t)
and its degree three Taylor polynomial.
> p:=t->t-t^3/6;
1
p := t → t − t 3
6
> evalf(dist1(f,g));
evalf(dist1(f,p));
0.0004341568841
0.003482512191
4) Display the three functions from (3) together in a single plot.
> actual:=plot(f(t),t=-1..1,color=red):
best:=plot(g(t),t=-1..1,color=black):
tay1:=plot(p(t),t=-1..1,color=blue):
display({actual,best,tay1});
0.8
0.6
0.4
0.2
–1
–0.8
–0.6
–0.4
–0.2
0
0.2
–0.2
–0.4
–0.6
–0.8
> actual:=plot(f(t),t=.7..1,color=red):
best:=plot(g(t),t=.7..1,color=black):
tay1:=plot(p(t),t=.7..1,color=blue):
display({actual,best,tay1});
0.4
0.6
t
0.8
1
0.8
0.75
0.7
0.65
0.7
0.75
0.8
0.85
0.9
0.95
1
t
5) Using the "dot2" inner product, MAPLE, and pencil and paper if necessary, find the projection
which is the degree 10 Fourier polynomial for the absolute value function f(t)=|t|. Hint: which of
these coefficients must be zero?
> dot2:=(f,g)->1/Pi*int(f(t)*g(t),t=-Pi..Pi);
π
1 ⌠
dot2 := (f, g ) →  f(t ) g(t ) dt
π ⌡−π
> f:=t->abs(t);
f := abs
> a0:=int(f(t),t=-Pi..Pi);
a0 := π 2
> for i from 1 to 10 do
g1:=t->cos(i*t):
g2:=t->sin(i*t):
a[i]:=dot2(g1,f):
b[i]:=dot2(g2,f):
od:
> fsum:=t->a0/(2*Pi)+sum(a[j]*cos(j*t),j=1..10)+sum(b[j]*sin(j*t),j=
1..10);
10
  10

a0 


fsum := t →
+  aj cos(j t ) +  bj sin(j t )
2 π j = 1
 j = 1

> fsum(t);
π 4 cos(t ) 4 cos(3 t ) 4 cos(5 t ) 4 cos(7 t ) 4 cos(9 t )
−
−
−
−
−
2
π
9
π
25
π
49
π
81
π
∑
∑
6) Create a display which shows the graph of f and of its Fourier polynomial, from #5.
> plot1:=plot(fsum(t),t=-Pi..Pi,color=black):
plot2:=plot(abs(t),t=-Pi..Pi,color=red):
display({plot1,plot2});
3
2.5
2
1.5
1
0.5
–3
–2
–1
0
1
2
3
t
7) Have MAPLE compute the derivative of your Fourier polynomial, and then plot this derivative
function. Does this graph seem to be related to the graph of the derivative of the absolute value
function? Explain.
> dfsum(t):=diff(fsum(t),t);
dabs(t):=diff(abs(t),t);
4 sin(t ) 4 sin(3 t ) 4 sin(5 t ) 4 sin(7 t ) 4 sin(9 t )
dfsum(t ) :=
+
+
+
+
π
3
π
5
π
7
π
9
π
dabs(t ) := abs(1, t )
> plot3:=plot(dfsum(t),t=-Pi..Pi,color=black):
plot4:=plot(dabs(t),t=-Pi..Pi,color=red):
display({plot3,plot4});
1
0.5
–3
–2
–1
0
1
2
t
–0.5
–1
>
3
Download