\documentclass[minion]{homework}
\newcommand{\Reals}{\mathbb{R}}
\doclabel{Math F615: Homework 5}
\docdate{Due: February 19, 2021}
\usepackage{graphicx}

\newcommand{\bfx}{\mathbf{x}}
\newcommand{\bfv}{\mathbf{v}}

\begin{document}

\begin{problems}

\problem Consider the matrix
\[
A = \begin{pmatrix} 
23 & -8 & 4\\
21 & -8 & 5\\
-126 & 42 & -19\end{pmatrix}.
\]
\begin{subproblems}
\item Show that $v_1=[-1,-2, 3]$,  $v_2=[1, 3 , 0]$ and 
$v_3=[0,1,2]$ are eigenvectors of $A$, and determine their
associated eigenvalues.
\item Compute the solution of
\[
u'=Au
\]
with initial condition $u(0)=v_3$.  Show, by plugging your solution
into the ODE, that your solution really is a solution.
\item Compute the solution of
\[
u'=Au
\]
with initial condition $u(0)=v_2+v_3$.  Show, by plugging your solution
into the ODE, that your solution really is a solution.
\item Determine the exact solution of
\[
u'=Au
\]
with initial condition $u(0) = [1,5,5]$.
\end{subproblems}

\problem Suppose you wish to apply the RK4 method to solve the ODE
of the previous problem.  What is the largest time step you can use before 
issues concerning absolute stability arise in your solution?

\problem
\begin{subproblems} 
\item Use your Newton solver from last week's homework to implement
the trapezoidal rule for solving systems of ODEs.  
\item Determine the exact solution to the problem
\begin{equation}
\begin{aligned}
u' &= 1\\
v' &= v - u^2
\end{aligned}
\end{equation}
with initial condition $u(0)=0$ and $v(0)=1$.
\item Test your solver against the previous exact solution
and confirm that it has the predicted order of accuracy.
\end{subproblems}

\problem Implement the explict method for solving the heat equation with
right-hand side function
\[
u_t=u_{xx} + f
\]
on $0\le x \le 1$ and $0\le t\le T$.  You function should have
the following signature:

forcedheat(f,u0,N,M)

where 
\begin{itemize}
	\item $f(x,t)$ is a function and provedes the desired forcing term 
	\item $u0(x)$ is a function and provides the desired
initial condition. 
    \item $N+1$ is the number of interior spatial steps
    \item $M$ is the number of time steps
\end{itemize}
It should return $(x,t,u)$ where $x$ is an array of grid coordinates
that includes $0$ and $1$, $t$ is a vector of $t$ coordinates that includes
$0$ and $T$, and where $u$ is an $(N+2)\times(M+1)$ matrix where column
$j$ encodes the solution at time $t_j$.

Test your code as follows

\begin{itemize}  
\item Compute what $f$ is if the solution is $u(t,x)=\sin(t)x(1-x)$.  
\item Now, working on $0\le x\le 1$ and $0\le t\le 2\pi$ 
compute solutions with this forcing term and compare your solution
with the exact solution.  By working with various grid sizes,
confirm that your code has the expected order of convergence.
\end{itemize}

\end{problems}
\end{document}