% 2017 Differential Equations 2280-2
\documentclass[11pt,leqno]{article}
\setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.4in} \setlength{\textheight}{9.5in}
\setlength{\parskip}{5pt} \setlength{\topmargin}{-90pt}
\setlength{\parindent}{0pt}
%\newenvironment{exercises}{\begin{list}{}{}}{\end{list}}
\newenvironment{solution}[1]{\protect\par{\bf Solution to Problem #1}.~\small\rm}{\protect\par\normalsize\rm}
%\long\def\answer#1{\begin{quote}\sf {\large\sf Answer:}\par #1\end{quote}}

\def\SeparatedPages#1{#1}
%\def\SeparatedPages#1{}
\def\prob#1#2{\item[{\normalsize\bf #1}] {\bf #2}}
\def\L{{\cal L}}
\def\dd{\displaystyle}
\def\BF#1{{\large\bf #1}}
\def\.#1{\mbox{\bf #1}}

\usepackage{linalg}
\newif\ifsolutions
\solutionstrue
%\solutionsfalse
\ifsolutions
\def\Answer#1{\rule{0.2\linewidth}{0.05em}\\ {\bf Answers and Solution Details}:\\ {\sf #1} \par\rule{\linewidth}{0.1em}}
\def\SeparatedPages#1{\relax}
\def\nextpage{\relax}
\else
\def\Answer#1{\relax}
\def\nextpage{\newpage}
\fi
\def\.#1{\vec{{\boldmath #1}}}
\begin{document}
\thispagestyle{empty}
%{\large\bf Name}
%\underline{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\hfill
%{{\bf Time of your class}~\underline{~~~~~~~~~~} }
\def\EJECT{\SeparatedPages
{\vfill Use this page to start your solution.\newpage
\thispagestyle{empty} \hfill  2280 Exam 3 S2017
%\newline{\large\bf Name}.
%\underline{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\hfill
}
}
%%% {\bf Time of your class}~\underline{~~~~~~~~~~} }
\def\EJECTEND{\SeparatedPages{\vfill Use this page to start your solution.
\eject}}
%\def\EJECT{}\def\EJECTEND{}

\begin{center}\Large\bf
Differential Equations 2280 \\
\small Midterm Exam 3\\
\small Exam Date: 14 April 2017 at 12:50pm
\end{center}


{\bf Instructions}: This in-class exam is 50 minutes. No
calculators, notes, tables or books. No answer check is expected.
Details count 3/4, answers count 1/4.
\subsection*{Chapter 3}
\begin{exercises}
\prob{1.}{(Linear Constant Equations of Order $n$)} ~\\[1ex]
\BF{(a)} [30\%] Find by variation of parameters a particular solution $y_p$ for the equation
$y''=x+x^2$. Show all steps in variation of parameters. Check the answer
by quadrature.
\nextpage\ifsolutions\else
\subsection*{Chapter 3}\fi

\BF{(b)} [40\%]  Find the {\bf Beats} solution for
the forced undamped spring-mass problem
$$ x'' + 256x = 247\cos(3t),\quad x(0)=x'(0)=0.$$
% de:=diff(x(t),t,t)+256*x(t)=247*cos(3*t), x(0)=0,D(x)(0)=0;
It is known that this solution is the sum of two harmonic oscillations of different frequencies.
{\bf To save time}, please don't convert your answer.
\nextpage\ifsolutions\else
\subsection*{Chapter 3}\fi

 \BF{(c)} [30\%] Let $f(x)=x^2\cos(x) - x(e^x + 1)$. Find the characteristic equation of a linear
 homogeneous scalar differential equation of least order such that $y=f(x)$ is a solution.

\bigskip

\ifsolutions
\Answer{~Problem 1: Chapter 3\\
\BF{Solution (a)} ~~ Answer: $\dd y_p=\frac16x^3+\frac{1}{12}x^4$.
\\
\BF{Variation of Parameters}.\newline
 Solve $y''=0$ to get $y_h=c_1y_1+c_2y_2$,
$y_1=1$, $y_2=x$.  Compute the
Wronskian $W=y_1y_2'-y_1'y_2=1$. Then for
$f(x)=x+x^2$,
\\
$\dd
 y_p=y_1\int y_2\frac{-f}{W}dx+y_2\int y_1\frac{f}{W}dx,
 $
\\
 $\dd
 y_p=1\int -x(x+x^2)dx+x\int 1(x+x^2)dx,
 $
\\
  $\dd
 y_p=-1\left(\frac{1}{3}x^3+\frac{1}{4}x^4\right)+x\left(\frac12x^2+\frac{1}{3}x^3\right),
 $
\\
  $\dd
 y_p=\frac16x^3 +\frac{1}{12}x^4\quad\mbox{Dropped terms for $1$, $x$.}
 $
\\
This answer is checked by quadrature, applied twice to $y'' = x+x^2$ with initial conditions zero.
% de1:=diff(y(x),x,x)=x+x^2; dsolve(de1,y(x));
% y(x) = y(x) = (1/12)*x^4+(1/6)*x^3+_C1*x+_C2
% int(int(x,x),x);int(int(x^2,x),x); #
\\[1ex]
\BF{Solution (b)} ~~The beats solution is identical to the superposition $x(t)$ of the undetermined coefficients solution $x_p(t)=d_1\cos(3t)+d_2\sin(3t)$ and the homogeneous solution $x_h(t)=c_1\cos(16t)+c_2\sin(16t)$, subject to $x(0)=x'(0)=0$, which determines constants $c_1,c_2$. Find $x_p$ first, then $d_1=1$, $d_2=0$. Use conditions $x(0)=x'(0)=0$ to solve for $c_1=-1$, $c_2=0$. The answer is Beats Solution = $x(t) = \cos(3t)-\cos(16t)$.
% de2:=diff(y(x),x,x) + 256*y(x) = 247*cos(3*x); ic2:=y(0)=0,D(y)(0)=0; dsolve([de2,ic2],y(x));
% y(x) = -cos(16*x)+cos(3*x)
\\[1ex]
\BF{Solution (c)}~~Write $f(x)=x^2\cos(x) - x(e^x + 1)=x^2\cos(x) - x - xe^x$, then identify Euler atoms $x,xe^x, x^2\cos(x)$.
Euler's multiplicity theorem implies that the characteristic equation has to have roots $0,0,1,1,i,i,i,-i,-i,-i$. For instance, solution $xe^x$ implies $r=1$ is a root of multiplicity $2$. The root-factor theorem of college algebra implies that $(r-1)^2$ is a factor of the characteristic polynomial. The minimal characteristic polynomial is then, by repeated application of the root-factor theorem of college algebra, $r^2(r-1)^2(r-i)^3(r+i)^3$.
The real form of the characteristic equation is $r^2(r-1)^2(r^2+1)^3=0$, which is a degree $10$ polynomial equation.
}
\fi


\end{exercises}
\EJECT

\subsection*{Chapters 4 and 5}
\begin{exercises}
\prob{6.}{(Systems of Differential Equations)} ~\newline
%\BF{Background}.  Let $A$ be a real $3\times 3$ matrix with eigenpairs
% $(\lambda_1,\.v_1)$,  $(\lambda_2,\.v_2)$,  $(\lambda_3,\.v_3)$.
% The eigenanalysis method says that the $3\times 3$ system
%$\.x' = A\.x$ has general solution
%$$\.x(t)=c_1\.v_1e^{\lambda_1
%t}+c_2\.v_2e^{\lambda_2 t}+c_3\.v_3e^{\lambda_3 t}.$$
%\BF{Background}. Let $A$ be an $n\times n$ real matrix. The method called \BF{Cayley-Hamilton-Ziebur} is based upon the result
%\begin{quote}\sf
%The components of solution $\.x$ of $\.x'(t)=A\.x(t)$ are linear combinations of Euler solution atoms obtained from the roots of the characteristic equation $|A-\lambda I|=0$.
%\end{quote}

 \BF{(a)} [30\%]  Assume a $3\times 3$ matrix $A$
has eigenvalues $\lambda=3,4,5$. State the Cayley-Hamilton-Ziebur theorem for this example. Then display a solution
formula for the vector solution $\vec{u}(t)$ to system $\frac{d}{dt}\vec{u} = A\vec{u}$, inserting what is known what is known from the eigenvalue information (supplied above).
\nextpage\ifsolutions\else
\subsection*{Chapters 4 and 5}\fi
\BF{(b)} [40\%]   A linear cascade, typically found in brine tank models, satisfies  $\frac{d}{dt}\vec{x}(t)=A\vec{x}(t)$ where the $4\times 4$ triangular matrix is
$$A=\left(\begin{array}{rrrr}
 1 & 1 &  0  & 0\\
 0 & 1 &  0  & 0\\
 0 & 0 &  3  & 1\\
 0 & 0 &  0  & 3
 \end{array}\right).$$


 \begin{quote}\sf
 \BF{Part 1}. Use the linear integrating factor method to find the vector general solution $\vec{x}(t)$ of $\frac{d}{dt}\vec{x}(t)=A\vec{x}(t)$.
\end{quote}
\nextpage\ifsolutions\else
\subsection*{Chapters 4 and 5}
\BF{(b)} [40\%]   A linear cascade, typically found in brine tank models, satisfies  $\frac{d}{dt}\vec{x}(t)=A\vec{x}(t)$ where the $4\times 4$ triangular matrix is
$$A=\left(\begin{array}{rrrr}
 1 & 1 &  0  & 0\\
 0 & 1 &  0  & 0\\
 0 & 0 &  3  & 1\\
 0 & 0 &  0  & 3
 \end{array}\right).$$
\fi

 \begin{quote}\sf
   \BF{Part 2}. Laplace's method applies to this example. Explain in a paragraph of text how to apply Laplace's method
 to this $4\times 4$ system. Don't use Laplace tables and don't find the solution! The explanation can use scalar equations or the vector-matrix equation $\frac{d}{dt}\vec{x}(t)=A\vec{x}(t)$.
\end{quote}
\nextpage\ifsolutions\else
\subsection*{Chapters 4 and 5}\fi
\begin{quote}\small
\BF{Background for (c)}. Let $A$ be an $n\times n$ real matrix. An augmented matrix $\Phi(t)$ of $n$ independent solutions of $\.x'(t)=A\.x(t)$ is called a
 \BF{fundamental matrix}. It is known that the general solution is $\.x(t)=\Phi(t)\.c$, where $\.c$ is a column vector of arbitrary constants $c_1, \ldots, c_n$. An alternate and widely used definition of fundamental matrix is  $\Phi'(t) = A\Phi(t)$, $|\Phi(0)| \ne 0$.
\end{quote}
   \BF{(c)} [30\%] The Cayley-Hamilton-Ziebur shortcut  applies especially to the system
   $$ x' = x + 5y,\quad y' = -5x + y,$$
   which has complex eigenvalues $\lambda = 1\pm 5i$.

\begin{quote}\sf
   \BF{Part 1}. Show the details of the method, finally displaying formulas for $x(t), y(t)$.

    \BF{Part 2}. Report a fundamental matrix $\Phi(t)$.

    \BF{Part 3}. Use \BF{Part 2} to find the exponential matrix $e^{At}$.
 \end{quote}
\ifsolutions
\Answer{~Problem 2: Chapters 4 and 5\\
\BF{Part (a)}~~Cayley-Hamilton-Ziebur says that the solution of $\frac{d}{dt}\.x(t)=A\.x(t)$ is a vector linear combination of the Euler solution atoms constructed from the roots of the characteristic equation $|A-\lambda I| = 0$. In this case, that means $\.x(t) = \.c_1e^{2t} + \.c_2e^{2t}+\.c_3e^{2t}$.
\\[1ex]
\BF{Part (b)} \\
\BF{(b) Part 1}. The components $x,y,z,w$ of the vector solution are given by formulas
$x = c_2te^{t}+c_1e^{t}$, $y=c_2e^t$, $z = c_4te^{3t}+c_3e^{3t}$, $w = c_4e^{3t}$, details below.
% {w(t) = _C4*exp(3*t), x(t) = (_C2*t+_C1)*exp(t), y(t) = _C2*exp(t), z(t) = (_C4*t+_C3)*exp(3*t)}
%de:=diff(x(t),t)=1*x(t)+y(t),diff(y(t),t)=1*y(t),diff(z(t),t)=3*z(t)+w(t),diff(w(t),t)=3*w(t);dsolve([de],[x(t),y(t),z(t),w(t)]);
% AA:=<1,1,0,0|0,1,0,0|0,0,3,1|0,0,0,3>^+;LinearAlgebra[Eigenvectors](AA);
\\
Write the system in scalar form
$$\begin{array}{lcl}
x' &=& x + y, \\
y' &=& y,\\
z' &=& 3z+w,\\
w' &=& 3w.
\end{array}
$$
Solve the fourth equation $w'=3w$ as \\
$w=\frac{\mbox{constant}}{\mbox{integrating factor}} = c_4e^{3t}$. \\
\fbox{$w = c_4e^{3t}$}\\
The third equation is\\
$z'=3z+c_4e^{3t}$\\
The linear integrating factor method applies.\\
$z'-3z=c_4e^{3t}$\\
$\dd\frac{(Wz)'}{W} = c_4e^{3t}$, where $W=e^{-3t}$,\\
$(Wz)' = c_4We^{3t}$\\
$(e^{-3t}z)' = c_4e^{-3t}e^{3t}$\\
$e^{-3t}z = c_4t + c_3.$\\
\fbox{$z = c_4te^{3t}+c_3e^{3t}$}\\
Solve the second equation as\\
$y=\frac{\mbox{constant}}{\mbox{integrating factor}} = c_2e^{t}$. \\
\fbox{$y=c_2e^t$}\\
Stuff the expression into the first differential equation:\\
$x' = x + y  = x + c_2e^{t}$\\
Then solve with the linear integrating factor method. \\
$x' - x = c_2e^{t}$\\
$\dd\frac{(Wx)'}{W} = c_2e^{t}$, where $W=e^{-t}$. Cross-multiply:\\
$(e^{-t}x)' = c_2e^{-t}e^{t}$, then integrate:\\
$e^{-t}x = c_2\,t+c_1$\\
Then divide by $e^{-t}$:\\
\fbox{$x = c_2te^{t}+c_1e^{t}$}\\
\BF{(b) Part 2}. \\
The matrix of coefficients is not diagonalizable, therefore the eigenanalysis method fails to apply. However,
Laplace's method applies anyway. The system is first transformed into $(sI-A)\L(\.u)=\.u_0$ where $\.u_0$ is a vector of arbitrary constants. Then $\L(\.u)$ is the inverse of $sI-A$ times $\.u_0$. Inverse transforms are applied to the inverse matrix $(sI-A)^{-1}$, called the resolvent, to obtain $\.u=\L^{-1}(sI-A)^{-1}\.u_0$.
\\[1ex]
\BF{Solution (c)}~~
The equations
   $ x' = x + 5y,\quad y' = -5x + y$
have coefficient matrix $A=\twobytwo{1&5}{-5&1}$ with characteristic equation $(1-\lambda)^2+25=0$. The roots are $1\pm 5i$. The Euler atoms are $e^{t}\cos(5t), e^{t}\sin(5t)$. \\
% AAA:=<1,5|-5,1>^+;LinearAlgebra[Eigenvalues](AAA);
\BF{(c) Part 1}.\\
By C-H-Z, $x=c_1e^{t}\cos(5t)+c_2e^{t}\sin(5t)$. Isolate $y$ from the first differential equation $x'=x+5y$, obtaining the formula $5y=x'-x=x+e^{t}\left(-5c_1\sin(5t) + 5c_2\cos(5t)\right)-x = -5c_1e^{t}\sin(5t)+5c_2e^{t}\cos(5t)$. Then the solution formulas are
$$
x=c_1e^{t}\cos(5t)+c_2e^{t}\sin(5t),\quad y(t)=-c_1e^{t}\sin(5t)+c_2e^{t}\cos(5t).
$$
\BF{(c) Part 2}\\
A fundamental matrix $\Phi(t)$ is found by taking partial derivatives on the symbols $c_1,c_2$. The answer is exactly the Jacobian matrix of $\colvector{x\\ y}$ with respect to variables $c_1,c_2$.\\
$\dd\Phi(t)=\twobytwo{e^{t}\cos(5t) & e^{t}\sin(5t)}{-e^{t}\sin(5t) & e^{t}\cos(5t)}$.
}
\fi
\end{exercises}
\EJECT
\ifsolutions\vfill\eject\fi
\subsection*{Chapter 6}

\begin{exercises}
\prob{1}{(Linear and Nonlinear Dynamical Systems)}
\newline
\BF{(a)} [20\%]
 Determine whether the unique equilibrium $\vec{u}=\vec{0}$ is stable or
unstable. Then classify the equilibrium point $\vec{u}=\vec{0}$ as a
saddle, center, spiral or node. Sub-classification into improper or proper node is not required.
 $$\frac{d}{dt}\vec{u}=\twobytwo{-1&1}{-2&1}\vec{u}$$
\\[2ex]
\BF{(b)} [30\%] Consider the nonlinear dynamical system
  $$\begin{array}{lcl}
  x'&=& x-2y^2-2y+32, \\
   y'&=& 2x(x-2y).
  \end{array}
 $$
 An equilibrium point is $x=-8$, $y=-4$. Compute
 the Jacobian matrix of the linearized system at this
 equilibrium point.
% f:=x-2*y*y-2*y+32;g:=2*x*(x-2*y); solve([f=0,g=0],[x,y]); [-8,4], [8,-4]
 \\[2ex]
\BF{(c)} [30\%] Consider the soft nonlinear spring system
  $\dd\left\{\begin{array}{lcl}
  x'&=& y, \\
   y'&=& -5x-2y+\frac54x^3.
  \end{array}\right.$\\
 %At equilibrium point $x=0$, $y=0$, the Jacobian matrix is
 %$A=J(0,0)=\left.\twobytwo{0&1}{-5+\frac{15}{4}x^3&-2}\right|_{x=0}=\twobytwo{0&1}{-5+\frac{15}{4}x^2&-2}$.
 %$\dd A=J(0,0)=\twobytwo{0&1}{-5&-2}$.
 \begin{quote}
   {\bf (1)}~~
  Determine the stability at $t=\infty$ and the phase portrait
  classification saddle, center, spiral
  or node at $\vec{u}=\vec{0}$ for the {\bf linear dynamical system} $\frac{d}{dt}\vec{u}=A\vec{u}$, where $A$ is the Jacobian matrix of this system at $x=2$, $y=0$.

   {\bf (2)}~~
  Apply the Pasting Theorem to classify $x=2$, $y=0$ as a saddle, center, spiral
  or node for the {\bf nonlinear dynamical system}. Discuss all details of the application of the theorem.
  {\em Details count 75\%}.

  % {\bf (3)}~~ Repeat the classification details of the previous two parts (1), (2) for the other two equilibrium points $(2,0), (-2,0)$, for which the Jacobian is
%$A=J(\pm2,0) = \twobytwo{0&1}{10&-2}$.
  \end{quote}

 \medskip

\BF{(d)} [20\%]  State the hypotheses and the conclusions of the {\em Pasting Theorem} used in part (c) above. Accuracy and completeness expected.

\bigskip
\ifsolutions
\Answer{~
Problem 3: Chapter 6\\
\BF{Solution (a)}~~ Answer: {\bf stable center}.\\
It is an unstable saddle. Details: The eigenvalues of $A$ are roots of $r^2+1=0$, which are complex roots
$i,-i$ with atoms $\cos t,\sin t$.
Rotation eliminates both saddle and node.
The atoms have no limit at either $\infty$ or $-\infty$, therefore it is a center.
%A:=<-1,1|-2,1>^+;LinearAlgebra[Eigenvectors](A);
\\[2ex]
\BF{Solution (b)}~~
% f:=x-2*y*y-2*y+32;g:=2*x*(x-2*y); solve([f=0,g=0],[x,y]); [8,4], [-8,-4], one more
% linalg[jacobian]([f,g],[x,y]);subs(x=-8,y=-4,%);
The Jacobian is $J(x,y)=\twobytwo{1&-4y-2}{4x-4y&-4x}$. Then $A=J(-8,-4)=\twobytwo{1&14}{-16&32}$.
\\[1ex]
\BF{Solution (c)}~~\\
\BF{(c) Part 1}~~\\
% f:=y;g:=-5*x-2*y+(5*x^3)/4; solve([f=0,g=0],[x,y]); [8,4], [-8,-4], one more
% linalg[jacobian]([f,g],[x,y]);A:=subs(x=2,y=0,%);linalg[eigenvals](A);
 The Jacobian is $J(x,y)=\twobytwo{0&-2}{-5+\frac{15}{4}x^2&-2}$. Then
$A=J(0,0)=\twobytwo{0 & 1}{10&-2}$. The eigenvalues of $A$ are found
from $r^2+2r-10=0$, giving real roots
$-1\pm \sqrt{11}$. Because no trig functions appear in the Euler solution atoms,
then no rotation happens, and the classification must be a saddle or a nodel. The Euler solution
atoms limit $(\infty,0)$ $t=\infty$ and $(0,\infty)$ at $t=-\infty$, therefore the node is eliminated and
it is a saddle. We report
a {\bf unstable saddle} for the linear problem $\vec{u}'=A\vec{u}$ at
equilibrium $\vec{u}=\vec{0}$.
\\[2ex]
\BF{(c) Part 2}~~\\ Theorem 2 in Edwards-Penney section 6.2 applies to say that
the same is true for the nonlinear system. Report: {\bf unstable saddle} at $x=0$,
$y=0$. \\[2ex]
\BF{Solution (d)}~~\\
 The pasting theorem assumes that $(x_0,y_0)$ is an isolated equilibrium point of the nonlinear system.
 The associated linear system is $\.u'=A\.u$, where $A$ is the Jacobian matrix of the nonlinear system evaluated at this point. The theorem says that a spiral, center, saddle or node for the linear system corresponds to a spiral, center, saddle or node, respectively, with two exceptions.
 \\
 Exception 1. If the equilibrium is a center for the linear problem, then the nonlinear system has either a center or a spiral at $(x_0,y_0)$, and the spiral can be either stable or unstable.
 \\
 Exception 2. If the equilibrium is a node for the linear problem with equal eigenvalues, then the nonlinear system has either a node or a spiral at $(x_0,y_0)$. The stability of the linear problem transfers to the nonlinear problem.
}
\fi
\end{exercises}
\EJECTEND
\end{document}
\endinput
