Consider the L2-ODE-CC (5) p.7b-7 with
l
o
g
(
1
+
x
)
{\displaystyle log(1+x)\!}
as excitation:
y
″
−
3
y
′
+
2
y
=
r
(
x
)
{\displaystyle y''-3y'+2y=r(x)\!}
(5) p.7b-7
r
(
x
)
=
l
o
g
(
1
+
x
)
{\displaystyle r(x)=log(1+x)\!}
(1) p.7c-28
and the initial conditions
y
(
−
3
4
)
=
1
,
y
′
(
−
3
4
)
=
0
{\displaystyle y({\frac {-3}{4}})=1,y'({\frac {-3}{4}})=0\!}
.
Project the excitation
r
(
x
)
{\displaystyle r(x)\!}
on the polynomial basis
b
j
(
x
)
=
x
j
,
j
=
0
,
1
,
.
.
.
,
n
{\displaystyle {b_{j}(x)=x^{j},j=0,1,...,n}\!}
(1)
i.e., find
d
j
{\displaystyle d_{j}\!}
such that
r
(
x
)
≈
r
n
(
x
)
=
∑
j
=
0
n
d
j
x
j
{\displaystyle r(x)\approx r_{n}(x)=\sum _{j=0}^{n}d_{j}x^{j}\!}
(2)
for x in
[
−
3
4
,
3
]
{\displaystyle [{\frac {-3}{4}},3]\!}
, and for n = 3, 6, 9.
Plot
r
(
x
)
{\displaystyle r(x)\!}
and
r
n
(
x
)
{\displaystyle r_{n}(x)\!}
to show uniform approximation and convergence.
Note that:
⟨
x
i
,
r
⟩
=
∫
a
b
x
i
l
o
g
(
1
+
x
)
d
x
{\displaystyle \left\langle x^{i},r\right\rangle =\int _{a}^{b}x^{i}log(1+x)dx\!}
(3)
Using Matlab, this is the code that was used to produce the results:
Find
y
n
(
x
)
{\displaystyle y_{n}(x)\!}
such that:
y
n
″
+
a
y
n
′
+
b
y
n
=
r
n
(
x
)
{\displaystyle y_{n}''+ay_{n}'+by_{n}=r_{n}(x)\!}
(1) p.7c-27
with the same initial conditions as in (2) p.7c-28.
Plot
y
n
(
x
)
{\displaystyle y_{n}(x)\!}
for n = 3, 6, 9, for x in
[
−
3
4
,
3
]
{\displaystyle [{\frac {-3}{4}},3]\!}
.
In a series of separate plots, compare the results obtained with the projected excitation on polynomial basis to those with truncated Taylor series of the excitation. Plot also the numerical solution as a baseline for comparison.
Using integration by parts, and then with the help of of
General Binomial Theorem
(
x
+
y
)
n
=
∑
k
=
0
n
(
n
k
)
x
n
−
k
y
k
{\displaystyle (x+y)^{n}=\sum _{k=0}^{n}{\binom {n}{k}}x^{n-k}y^{k}\!}
For
n
=
0
{\displaystyle n=0\!}
:
∫
x
0
l
o
g
(
1
+
x
)
d
x
=
∫
l
o
g
(
1
+
x
)
d
x
{\displaystyle \int x^{0}log(1+x)dx=\int log(1+x)dx\!}
For substitution by parts,
u
=
l
o
g
(
1
+
x
)
,
d
u
=
1
1
+
x
,
d
v
=
d
x
,
v
=
x
{\displaystyle u=log(1+x),du={\frac {1}{1+x}},dv=dx,v=x\!}
∫
l
o
g
(
1
+
x
)
d
x
=
x
l
o
g
(
1
+
x
)
−
∫
x
1
+
x
d
x
{\displaystyle \int log(1+x)dx=xlog(1+x)-\int {\frac {x}{1+x}}dx\!}
∫
l
o
g
(
1
+
x
)
d
x
=
x
l
o
g
(
1
+
x
)
−
∫
(
1
−
1
1
+
x
)
d
x
{\displaystyle \int log(1+x)dx=xlog(1+x)-\int (1-{\frac {1}{1+x}})dx\!}
∫
l
o
g
(
1
+
x
)
d
x
=
x
l
o
g
(
1
+
x
)
−
x
+
l
o
g
(
1
+
x
)
+
C
{\displaystyle \int log(1+x)dx=xlog(1+x)-x+log(1+x)+C\!}
Therefore:
∫
l
o
g
(
1
+
x
)
d
x
=
(
x
+
1
)
l
o
g
(
1
+
x
)
−
x
+
C
{\displaystyle \int log(1+x)dx=(x+1)log(1+x)-x+C\!}
Using the General Binomial Theorem:
(
x
+
y
)
0
=
∑
k
=
0
0
(
0
k
)
x
0
−
k
y
k
=
1
{\displaystyle (x+y)^{0}=\sum _{k=0}^{0}{\binom {0}{k}}x^{0-k}y^{k}=1\!}
Therefore:
∫
(
1
)
l
o
g
(
1
+
x
)
d
x
=
∫
l
o
g
(
1
+
x
)
d
x
{\displaystyle \int (1)log(1+x)dx=\int log(1+x)dx\!}
Which we have previously found that answer as:
∫
l
o
g
(
1
+
x
)
d
x
=
(
x
+
1
)
l
o
g
(
1
+
x
)
−
x
+
C
{\displaystyle \int log(1+x)dx=(x+1)log(1+x)-x+C\!}
For
n
=
1
{\displaystyle n=1\!}
:
∫
x
1
l
o
g
(
1
+
x
)
d
x
=
∫
x
l
o
g
(
1
+
x
)
d
x
{\displaystyle \int x^{1}log(1+x)dx=\int xlog(1+x)dx\!}
Initially we use the following substitutions:
t
=
1
+
x
,
x
=
t
−
1
,
d
t
=
d
x
{\displaystyle t=1+x,x=t-1,dt=dx\!}
∫
x
l
o
g
(
1
+
x
)
d
x
=
∫
(
t
−
1
)
l
o
g
(
t
)
d
t
=
∫
(
t
l
o
g
(
t
)
−
log
(
t
)
)
d
t
{\displaystyle \int xlog(1+x)dx=\int (t-1)log(t)dt=\int (tlog(t)-\log(t))dt\!}
First let us consider the first term:
∫
t
l
o
g
(
t
)
d
t
{\displaystyle \int tlog(t)dt\!}
Next, we use the integration by parts:
u
=
log
t
,
d
u
=
1
t
d
t
,
d
v
=
t
d
t
,
v
=
1
2
t
2
{\displaystyle u=\log {t},du={\frac {1}{t}}dt,dv=tdt,v={\frac {1}{2}}t^{2}\!}
∫
t
l
o
g
(
t
)
d
t
=
1
2
t
2
l
o
g
(
t
)
−
∫
1
2
t
2
(
1
t
d
t
)
{\displaystyle \int tlog(t)dt={\frac {1}{2}}t^{2}log(t)-\int {\frac {1}{2}}t^{2}({\frac {1}{t}}dt)\!}
∫
t
l
o
g
(
t
)
d
t
=
1
2
t
2
l
o
g
(
t
)
−
∫
1
2
t
d
t
)
{\displaystyle \int tlog(t)dt={\frac {1}{2}}t^{2}log(t)-\int {\frac {1}{2}}tdt)\!}
∫
t
l
o
g
(
t
)
d
t
=
1
2
t
2
l
o
g
(
t
)
−
1
4
t
2
{\displaystyle \int tlog(t)dt={\frac {1}{2}}t^{2}log(t)-{\frac {1}{4}}t^{2}\!}
Next let us consider the second term:
∫
l
o
g
(
t
)
d
t
{\displaystyle \int log(t)dt\!}
Again, we will use integration by parts:
u
=
log
t
,
d
u
=
1
t
d
t
,
d
v
=
d
t
,
v
=
t
{\displaystyle u=\log {t},du={\frac {1}{t}}dt,dv=dt,v=t\!}
∫
t
l
o
g
(
t
)
d
t
=
t
l
o
g
(
t
)
−
∫
t
(
1
t
d
t
)
{\displaystyle \int tlog(t)dt=tlog(t)-\int t({\frac {1}{t}}dt)\!}
∫
t
l
o
g
(
t
)
d
t
=
t
l
o
g
(
t
)
−
∫
d
t
{\displaystyle \int tlog(t)dt=tlog(t)-\int dt\!}
∫
t
l
o
g
(
t
)
d
t
=
t
l
o
g
(
t
)
−
t
{\displaystyle \int tlog(t)dt=tlog(t)-t\!}
Therefore:
∫
(
t
l
o
g
(
t
)
−
log
(
t
)
)
d
t
=
1
2
t
2
l
o
g
(
t
)
−
1
4
t
2
−
(
t
l
o
g
(
t
)
−
t
)
{\displaystyle \int (tlog(t)-\log(t))dt={\frac {1}{2}}t^{2}log(t)-{\frac {1}{4}}t^{2}-(tlog(t)-t)\!}
∫
(
t
l
o
g
(
t
)
−
log
(
t
)
)
d
t
=
1
2
t
2
l
o
g
(
t
)
−
1
4
t
2
−
t
l
o
g
(
t
)
+
t
{\displaystyle \int (tlog(t)-\log(t))dt={\frac {1}{2}}t^{2}log(t)-{\frac {1}{4}}t^{2}-tlog(t)+t\!}
Re-substituting for t:
∫
x
l
o
g
(
1
+
x
)
d
x
=
1
2
(
1
+
x
)
2
l
o
g
(
1
+
x
)
−
1
4
(
1
+
x
)
2
−
(
1
+
x
)
l
o
g
(
1
+
x
)
+
(
1
+
x
)
+
C
{\displaystyle \int xlog(1+x)dx={\frac {1}{2}}(1+x)^{2}log(1+x)-{\frac {1}{4}}(1+x)^{2}-(1+x)log(1+x)+(1+x)+C\!}
∫
x
l
o
g
(
1
+
x
)
d
x
=
(
1
+
x
)
(
1
2
(
1
+
x
)
l
o
g
(
1
+
x
)
−
1
4
(
1
+
x
)
−
l
o
g
(
1
+
x
)
+
1
)
+
C
{\displaystyle \int xlog(1+x)dx=(1+x)({\frac {1}{2}}(1+x)log(1+x)-{\frac {1}{4}}(1+x)-log(1+x)+1)+C\!}
∫
x
l
o
g
(
1
+
x
)
d
x
=
(
1
+
x
)
(
1
2
x
l
o
g
(
1
+
x
)
−
1
2
l
o
g
(
1
+
x
)
−
1
4
x
+
3
4
)
+
C
{\displaystyle \int xlog(1+x)dx=(1+x)({\frac {1}{2}}xlog(1+x)-{\frac {1}{2}}log(1+x)-{\frac {1}{4}}x+{\frac {3}{4}})+C\!}
Therefore:
∫
x
l
o
g
(
1
+
x
)
d
x
=
(
1
+
x
)
(
1
2
x
l
o
g
(
1
+
x
)
−
1
2
l
o
g
(
1
+
x
)
−
1
4
x
+
3
4
)
+
C
{\displaystyle \int xlog(1+x)dx=(1+x)({\frac {1}{2}}xlog(1+x)-{\frac {1}{2}}log(1+x)-{\frac {1}{4}}x+{\frac {3}{4}})+C\!}
Using the General Binomial Theorem for the integral with t substitution
∫
(
t
−
1
)
l
o
g
(
t
)
d
t
{\displaystyle \int (t-1)log(t)dt\!}
:
(
x
+
y
)
1
=
(
t
+
(
−
1
)
)
1
=
(
t
+
(
−
1
)
)
=
∑
k
=
0
1
(
1
k
)
x
1
−
k
y
k
=
∑
k
=
0
1
(
1
k
)
t
1
−
k
(
−
1
)
k
=
t
−
1
{\displaystyle (x+y)^{1}=(t+(-1))^{1}=(t+(-1))=\sum _{k=0}^{1}{\binom {1}{k}}x^{1-k}y^{k}=\sum _{k=0}^{1}{\binom {1}{k}}t^{1-k}(-1)^{k}=t-1\!}
Therefore:
∫
(
t
−
1
)
l
o
g
(
t
)
d
t
=
∫
x
l
o
g
(
1
+
x
)
d
x
{\displaystyle \int (t-1)log(t)dt=\int xlog(1+x)dx\!}
Which we have previously found that answer as:
∫
x
l
o
g
(
1
+
x
)
d
x
=
(
1
+
x
)
(
1
2
x
l
o
g
(
1
+
x
)
−
1
2
l
o
g
(
1
+
x
)
−
1
4
x
+
3
4
)
+
C
{\displaystyle \int xlog(1+x)dx=(1+x)({\frac {1}{2}}xlog(1+x)-{\frac {1}{2}}log(1+x)-{\frac {1}{4}}x+{\frac {3}{4}})+C\!}