Given the Boundary Value Problem
Given the Boundary Value Problem
-(Y')'=λY⇔Y''+Y'+λY=0
x
e
x
e
x
e
x
e
x
e
Y''+Y'+λY=0
Y(0)=0,Y(π)=0
a)
a)
Clear["Global`*"]
The eigenvalues of the BVP are
In[]:=
λ[n_]=1/4+n^2;
and the eigenfunctions
In[]:=
Y[x_,n_]=Exp[-1/2*x]*Sin[n*x]
Out[]=
-x/2
We check whether the eigenfunctions are orthogonal by calculating the inner product
In[]:=
Integrate[Y[x,1]*Y[x,2],{x,0,Pi}]
Out[]=
1
5
-π
It is not zero, so it is not orthogonal
Normalizing eigenfunctions to the new inner product by weight
Normalizing eigenfunctions to the new inner product by weight
In[]:=
Clear["Global`*"]
Given the eigenfunctions (x)sinnx . Find the weight function in which the eigenfunctions are orthogonal .
Y
n
-
x
2
e
||f
||
m
1
2
w(x)f(x)d(x)
1
∫
0
In[]:=
λ[n_]=1/4+n^2
Out[]=
1
4
2
n
In[]:=
Y[x_,n_]=Exp[-1/2*x]*Sin[n*x]
Out[]=
-x/2
The norm is now defined
In[]:=
norm[n_]=Sqrt[Integrate[Exp[x]*Y[x,n]^2,{x,0,Pi}]]
Out[]=
π
2
Sin[2nπ]
4n
In[]:=
Simplify[%,n∈Integers&&n>0]
Out[]=
π
2
We define the normalized eigenfunctions (x),
X
n
In[]:=
X[x_,n_]=Y[x,n]/norm[n];
We check if the functions (x),(x), , are orthogonal to the inner product with weight
X
n
X
m
n≠m
In[]:=
Integrate[Exp[x]*X[x,1]*X[x,2],{x,0,Pi}]
Out[]=
0
So the normalized eigenfunctions are orthogonal to the new inner product with weight
In[]:=
Table[Plot[X[x,n],{x,0,1},PlotStyle{Red,Thick},PlotLabelExpand[X[x,n]]],{n,1,4}]
Out[]=
,
,
,
Expansion to the eigenfunctions in terms of the inner product by weight
Expansion to the eigenfunctions in terms of the inner product by weight
We define the function
In[]:=
f[x_]=x*(Pi-x)
Out[]=
(π-x)x
We plot the graph of the function
In[]:=
pic1=Plot[f[x],{x,0,1},PlotStyle->{Thick},PlotRangeAll]
Out[]=
In[]:=
FPS[x_,N_]=FullSimplifyc[n]*X[x,n];
N
∑
n=1
In[]:=
c[n_]=Simplifyf[x]*X[x,n]x;
1
∫
0
Now we define the partial sums
Now we plot the graphs for N=5,15,20
Now we plot the graphs for N=5,15,20
In[]:=
FS1[x_]=FPS[x,5];
In[]:=
pFS1=Plot[FS1[x],{x,0,1},PlotStyle->{Red,Dashed},PlotRangeAll]
Out[]=
In[]:=
FS2[x_]=FPS[x,15];
In[]:=
pFS2=Plot[FS2[x],{x,0,1},PlotStyle->{Magenta,Thick},PlotRangeAll]
Out[]=
In[]:=
FS3[x_]=FPS[x,20];
In[]:=
pFS3=Plot[FS3[x],{x,0,1},PlotStyle->{Black,Dashed,Thick},PlotRangeAll]
Out[]=
In[]:=
Show[pic1,pFS1,pFS2,pFS3]
Out[]=
We note that it does not converge on the function f (x)