\[y_{n+1}=y_{n}+\frac{h}{6}(k_1+2k_2+2k_3+k_4)\]
where
\[k_1=f(x_n,y_n)\]
\[k_2=f(x_n+\frac{1}{2}h,y_n+\frac{1}{2}hk_1)\]
\[k_3=f(x_n+\frac{1}{2}h,y_n+\frac{1}{2}hk_2)\]
\[k_4=f(x_n+h,y_n+hk_3)\]
\[h=0.2\]
With the initial condition $x_{0}=0, y_{0}=0.5$
\[\begin{align*}y_{1}&=y_{0}+\frac{h}{6}(k_1+2k_2+2k_3+k_4)\\
k_1&=f(x_0,y_0)=f(0,0.5)\approx0.71\\
k_2&=f(x_0+1/2h,y_0+1/2hk_2)=f(0.1, 0.5+0.1\times0.71)\approx0.123\\
k_3&=f(0.1, 0.5+0.1\times0.123)\approx0.1038\\
k_4&=f(0.2, 0.5+0.2\times0.1038)\approx0.136\\
y_1&=y_{0}+\frac{h}{6}(k_1+2k_2+2k_3+k_4)=0.5+\frac{0.2}{6}(0.71+2\times0.123+2\times0.1038+0.136)\approx 0.5206
\end{align*}\]
Therefore
\[x_1=0.2, y_{1}=0.5206\]
Repeating the process above 5 times yields
\[\begin{center}
\begin{tabular}{ c c c }
n & x_n & y_n\\
0 & 0 & 0.5 \\
1 & 0.2 & 0.5206 \\
2 & 0.4 & 0.5551\\
3 & 0.6 & 0.6063 \\
4 & 0.8 & 0.6783 \\
5 & 1.0 & 0.7767 \\
\end{tabular}
\end{center}\]
Thus, $y(1)$ is 0.7767 under the approximation of RK-4 method.
\\
\\
\\
\textbf{b.}(10) Given $y'=3+x-y=f(x,y)$ $y(0)=1$, approximate $y(0.1)$ using one step with Runge-Kutta method. Use this to find a bound for the local truncation error at $y_1$.
\\
\\
\textbf{Solution}
\\
\\
.
\\
\[k_1=f(0,1)=3+0-1=2\]
\[k_2=f\left(0+\frac{0.1}{2},1+\frac{0.1}{2}k_1\right)=1.95\]
\[k_3=f\left((0+\frac{0.1}{2},1+\frac{0.1}{2}k_2\right)=1.9525\]
\[k_4=f\left(0+0.1,1+0.1k_3\right)=1.90475\]
\[y(0.1)=y(0)+\frac{0.1}{6}(k_1+2k_2+2k_3+k_4)=\frac{0.1}{6}(2+2*1.95+2*1.9525+1.90475)=0.1951625\]
Refer to the analytic solution
\[y'=1+e^{-x},y''=-e^{-x},\cdots,y^{(5)}=e^{-x}\]
\[\frac{y^{(5)}(c)}{5!}h^5=\frac{(0.1)^5e^{-c}}{5!}\]
Thus, with $c=0.1$, the expression above yields a bound of $7.54031\times10^{-8}$.
\\
\\
\\
\\
\textbf{2)a.}(15) Let $u=f(x,y)$. Use separation of variables to find all possible solutions.
\\
\\
\textbf{Solution}
\\
\\
Let $u=X(x)Y(y)$
\\
Then
\[0=x^2\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=x^2X''Y+XY''\]
\[\iff \frac{x^2X''}{X}=\frac{Y''}{-Y}=\lambda\]
where $\lambda$ is a constant
\[\iff x^2X''-\lambda X=0, Y''+\lambda Y=0\]
\\
The auxiliary equation for $x$'s equation is given by $n(n-1)-\lambda=0$\\
Solve it, we get $n_1=\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}, n_2=\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}$\\
Thus, if $0>\lambda>-1/4$
\[X=c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}}, Y=c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y\]
\[u(x,y)=(c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}})(c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y)\]
\\
If $\lambda<-\frac{1}{4}$
\\
\[X=x^\frac{1}{2}\left(c_1\cos\left(\sqrt{-1-4\lambda}/2\ln x\right)+c_2\sin\left(\sqrt{-1-4\lambda}/2\ln x\right)\right), Y=c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y\]
\[u=(x^\frac{1}{2}[c_1\cos(\sqrt{-1-4\lambda}/2\ln x)+c_2\sin(\sqrt{-1-4\lambda}/2\ln x)])(c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y)\]
\\
\\
If $\lambda>0$, then
\[Y=c_3e^{\sqrt{\lambda}y}+c_4e^{-\sqrt{\lambda} y}\]
\[u=\left(c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}}\right)\left(c_3e^{\sqrt{\lambda}y}+c_4e^{-\sqrt{\lambda} y}\right)\]
\\
Additionally, $u\equiv 0$ is also a solution.
\\
\\
\textbf{2b.}(15)
\\
\\
Since the left side is insulated, the lower insulated part has the same temperature as that of point $(0,0)$, thus it should be $u(0,0)=f(0)$. The BVP would be
\[\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=0\]
with boundary conditions:
\[u(x,0) = \begin{cases} f(x) & \mbox{if } 0\le x\le\frac{\pi}{2} \\ g(x) & \mbox{if } \frac{\pi}{2}< x\le \pi \end{cases}, \frac{\partial u}{\partial x}=0 \mbox{ at } x=0, \]
\[u(0,y)=\begin{cases} f(0) & \mbox{if } 0\le y\le \pi^2 \\ 0 & \mbox{if } \pi^2< y \end{cases}, u(\pi,y)=\begin{cases} e^y & \mbox{if } 0\le y<\pi \\ y^{-2} & \mbox{if } \pi\le y \end{cases}\]
\\
\begin{tikzpicture}
\coordinate[label=0:$\pi$] (p) at (2.6,1.3);
\coordinate[label=0:$\pi^2$] (p2) at (0,2.5);
\coordinate (pc2) at (1.3,0);
\coordinate[label=-90:$0$] (O) at (p2|-pc2);
\coordinate[label=-90:$\pi$] (px) at (p|-pc2);
\fill (p2) circle (1.5pt) (p) circle (1.5pt);
\draw (pc2)--+(0,0.2)node[above]{$\frac\pi2$};
\draw[<->] (0,4) --node[right]{0} (p2) --node[right]{$f(0)$} (O)
--node[above]{$f(x)$} (pc2) --node[above]{$g(x)$} (px)
--node[right]{$e^y$} (p) --node[above right]{$y^{-2}$} ++(0,2.5);
\end{tikzpicture}
\\
\\
\textbf{3)}(20) Solve the following heat problem using separation of variable. Draw a diagram of the situation.
\\
\\
\textbf{Solution}
\\
\\
Let $u=XT$, then
\[XT'=kX''T\iff \frac{X''}{X}=\frac{T'}{kT}=-\lambda\]
\[T'+k\lambda T=0 \to T=c_1e^{-\lambda kt}\]
If $\lambda=\alpha^2$
\[X=c_2\cos\alpha x+c_3\sin\alpha x\]
If $\lambda=-\alpha^2$
\[X=c_2e^{\alpha x}+c_3e^{-\alpha x}\]
If $\lambda=0$ then
\[X=c_2+c_3x\]
where
\[k_1=f(x_n,y_n)\]
\[k_2=f(x_n+\frac{1}{2}h,y_n+\frac{1}{2}hk_1)\]
\[k_3=f(x_n+\frac{1}{2}h,y_n+\frac{1}{2}hk_2)\]
\[k_4=f(x_n+h,y_n+hk_3)\]
\[h=0.2\]
With the initial condition $x_{0}=0, y_{0}=0.5$
\[\begin{align*}y_{1}&=y_{0}+\frac{h}{6}(k_1+2k_2+2k_3+k_4)\\
k_1&=f(x_0,y_0)=f(0,0.5)\approx0.71\\
k_2&=f(x_0+1/2h,y_0+1/2hk_2)=f(0.1, 0.5+0.1\times0.71)\approx0.123\\
k_3&=f(0.1, 0.5+0.1\times0.123)\approx0.1038\\
k_4&=f(0.2, 0.5+0.2\times0.1038)\approx0.136\\
y_1&=y_{0}+\frac{h}{6}(k_1+2k_2+2k_3+k_4)=0.5+\frac{0.2}{6}(0.71+2\times0.123+2\times0.1038+0.136)\approx 0.5206
\end{align*}\]
Therefore
\[x_1=0.2, y_{1}=0.5206\]
Repeating the process above 5 times yields
\[\begin{center}
\begin{tabular}{ c c c }
n & x_n & y_n\\
0 & 0 & 0.5 \\
1 & 0.2 & 0.5206 \\
2 & 0.4 & 0.5551\\
3 & 0.6 & 0.6063 \\
4 & 0.8 & 0.6783 \\
5 & 1.0 & 0.7767 \\
\end{tabular}
\end{center}\]
Thus, $y(1)$ is 0.7767 under the approximation of RK-4 method.
\\
\\
\\
\textbf{b.}(10) Given $y'=3+x-y=f(x,y)$ $y(0)=1$, approximate $y(0.1)$ using one step with Runge-Kutta method. Use this to find a bound for the local truncation error at $y_1$.
\\
\\
\textbf{Solution}
\\
\\
.
\\
\[k_1=f(0,1)=3+0-1=2\]
\[k_2=f\left(0+\frac{0.1}{2},1+\frac{0.1}{2}k_1\right)=1.95\]
\[k_3=f\left((0+\frac{0.1}{2},1+\frac{0.1}{2}k_2\right)=1.9525\]
\[k_4=f\left(0+0.1,1+0.1k_3\right)=1.90475\]
\[y(0.1)=y(0)+\frac{0.1}{6}(k_1+2k_2+2k_3+k_4)=\frac{0.1}{6}(2+2*1.95+2*1.9525+1.90475)=0.1951625\]
Refer to the analytic solution
\[y'=1+e^{-x},y''=-e^{-x},\cdots,y^{(5)}=e^{-x}\]
\[\frac{y^{(5)}(c)}{5!}h^5=\frac{(0.1)^5e^{-c}}{5!}\]
Thus, with $c=0.1$, the expression above yields a bound of $7.54031\times10^{-8}$.
\\
\\
\\
\\
\textbf{2)a.}(15) Let $u=f(x,y)$. Use separation of variables to find all possible solutions.
\\
\\
\textbf{Solution}
\\
\\
Let $u=X(x)Y(y)$
\\
Then
\[0=x^2\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=x^2X''Y+XY''\]
\[\iff \frac{x^2X''}{X}=\frac{Y''}{-Y}=\lambda\]
where $\lambda$ is a constant
\[\iff x^2X''-\lambda X=0, Y''+\lambda Y=0\]
\\
The auxiliary equation for $x$'s equation is given by $n(n-1)-\lambda=0$\\
Solve it, we get $n_1=\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}, n_2=\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}$\\
Thus, if $0>\lambda>-1/4$
\[X=c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}}, Y=c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y\]
\[u(x,y)=(c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}})(c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y)\]
\\
If $\lambda<-\frac{1}{4}$
\\
\[X=x^\frac{1}{2}\left(c_1\cos\left(\sqrt{-1-4\lambda}/2\ln x\right)+c_2\sin\left(\sqrt{-1-4\lambda}/2\ln x\right)\right), Y=c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y\]
\[u=(x^\frac{1}{2}[c_1\cos(\sqrt{-1-4\lambda}/2\ln x)+c_2\sin(\sqrt{-1-4\lambda}/2\ln x)])(c_3\cosh\sqrt{-\lambda }y+c_4\sinh\sqrt{-\lambda }y)\]
\\
\\
If $\lambda>0$, then
\[Y=c_3e^{\sqrt{\lambda}y}+c_4e^{-\sqrt{\lambda} y}\]
\[u=\left(c_1x^{\frac{1}{2}+\frac{\sqrt{1+4\lambda}}{2}}+c_2x^{\frac{1}{2}-\frac{\sqrt{1+4\lambda}}{2}}\right)\left(c_3e^{\sqrt{\lambda}y}+c_4e^{-\sqrt{\lambda} y}\right)\]
\\
Additionally, $u\equiv 0$ is also a solution.
\\
\\
\textbf{2b.}(15)
\\
\\
Since the left side is insulated, the lower insulated part has the same temperature as that of point $(0,0)$, thus it should be $u(0,0)=f(0)$. The BVP would be
\[\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=0\]
with boundary conditions:
\[u(x,0) = \begin{cases} f(x) & \mbox{if } 0\le x\le\frac{\pi}{2} \\ g(x) & \mbox{if } \frac{\pi}{2}< x\le \pi \end{cases}, \frac{\partial u}{\partial x}=0 \mbox{ at } x=0, \]
\[u(0,y)=\begin{cases} f(0) & \mbox{if } 0\le y\le \pi^2 \\ 0 & \mbox{if } \pi^2< y \end{cases}, u(\pi,y)=\begin{cases} e^y & \mbox{if } 0\le y<\pi \\ y^{-2} & \mbox{if } \pi\le y \end{cases}\]
\\
\begin{tikzpicture}
\coordinate[label=0:$\pi$] (p) at (2.6,1.3);
\coordinate[label=0:$\pi^2$] (p2) at (0,2.5);
\coordinate (pc2) at (1.3,0);
\coordinate[label=-90:$0$] (O) at (p2|-pc2);
\coordinate[label=-90:$\pi$] (px) at (p|-pc2);
\fill (p2) circle (1.5pt) (p) circle (1.5pt);
\draw (pc2)--+(0,0.2)node[above]{$\frac\pi2$};
\draw[<->] (0,4) --node[right]{0} (p2) --node[right]{$f(0)$} (O)
--node[above]{$f(x)$} (pc2) --node[above]{$g(x)$} (px)
--node[right]{$e^y$} (p) --node[above right]{$y^{-2}$} ++(0,2.5);
\end{tikzpicture}
\\
\\
\textbf{3)}(20) Solve the following heat problem using separation of variable. Draw a diagram of the situation.
\\
\\
\textbf{Solution}
\\
\\
Let $u=XT$, then
\[XT'=kX''T\iff \frac{X''}{X}=\frac{T'}{kT}=-\lambda\]
\[T'+k\lambda T=0 \to T=c_1e^{-\lambda kt}\]
If $\lambda=\alpha^2$
\[X=c_2\cos\alpha x+c_3\sin\alpha x\]
If $\lambda=-\alpha^2$
\[X=c_2e^{\alpha x}+c_3e^{-\alpha x}\]
If $\lambda=0$ then
\[X=c_2+c_3x\]