# Initial Layer¶

### An example¶

Consider the initial value problem

$\epsilon y^\prime +y=e^{-t}, ~~~~~~~~ y(0)=2$

#### Outer approximation¶

Setting $\epsilon =0$, we will get $y(t)=e^{-t}$ or we can write

$$y_o(t)=e^{-t} ~~ \text{where} ~~ t \sim O (1).$$

#### Inner approximation¶

Rescale time: $\displaystyle \tau=\frac{t}{\delta(\epsilon)}$ and define $z(\tau)=y(t)$.

Subsituting $z(\tau)$ in the given ODE we will get

$\frac{\epsilon}{\delta} z^\prime +z=1, ~~ \text{where} ~~ t \sim O (\epsilon).$

We see that $\delta(\epsilon)=\epsilon$ would make all the terms in the given ODE $\sim O (1)$. Subsituting $\delta(\epsilon)=\epsilon$ we will get

$z^\prime +z=1, ~~ \text{where} ~~ t \sim O (\epsilon).$

Soving this ODE we will get $z(\tau)=1+Ce^{-\tau}$ therefore we can write the inner approximation as

${y_i(t)}=1+Ce^{-t/\epsilon}$

Using the initial condition $z(0)=y(0)=2$, we get $C=1$ so

$${y_i(t)}=1+e^{-t/\epsilon} ~~ \text{where} ~~ t \sim O (\epsilon).$$

• Check that C=1 also satisfies the matching condition $\displaystyle \lim_{t \to 0} y_o(t)=\lim_{\tau \to \infty} y_i(\tau)$ =1.

#### Uniform approximation¶

$y_u(t)=y_o(t)+y_i(t)-1$ or

$$y_u(t)=e^{-t}+e^{-t/\epsilon}$$
In [1]:
# Solve the differential equation
# import all the packages required
import numpy as np
import matplotlib.pyplot as plt
% matplotlib inline
from scipy.integrate import odeint

ep=0.05

def fun(X,t):
x=X[0];
dx=1.0/ep*(-x+np.exp(-t));

return [dx]

plt.figure(figsize=(10,6))

# Times at which the solution is to be computed.
t = np.linspace(0, 3, 5000)
# Initial condition
Xinit=[2]
# scipy's ode solver
Xsolu = odeint(fun,Xinit,t)

#plotting commands
plt.plot(t, Xsolu[:,0],'r-',lw=2,label='Exact Solution')

yi=1+np.exp(-t/ep)
plt.plot(t,yi,'g-',lw=2,label='Inner layer')

yo=np.exp(-t);
plt.plot(t,yo,'b-',lw=2,label='Outer layer')

yu=np.exp(-t)+np.exp(-t/ep)
plt.plot(t,yu,'k--',lw=4,label='Uniform approximation')

plt.legend(bbox_to_anchor=(0.9, 1.0), loc=1, borderaxespad=0.,fontsize=14)
plt.xlabel('$t$',fontsize=20);plt.ylabel('$y(t)$',fontsize=20)
plt.xticks(fontsize = 20);plt.yticks(fontsize = 20)
plt.show()