\magnification=\magstep1
\overfullrule=0pt
\centerline{Mathematics 304 -- Ordinary Differential Equations}
\centerline{Lab/Problem Set 7 -- 2nd Order Equations and RLC Circuits }
\centerline{October 29, 2004}
\bigskip
\noindent
{\it Background and Goals}
\bigskip
Today we will apply our knowledge of 2nd order linear ODE to some
questions about electrical circuits.  An ``RLC circuit'' is one that 
contains a voltage source $v_T(t)$ (time dependent), 
a {\it resistor} (i.e. something that {\it dissipates electrical 
energy}) with resistance $R$, an {\it inductor} (a device or component 
that {\it stores magnetic energy}) with inductance $L$, and a {\it capacitor} 
(a device or component that {\it stores electrical energy}) with capacitance 
$C$.  Many basic electrical circuits have this form.

It can be shown that the voltage change across the capacitor,
written $v_C$, satisfies the 2nd order ODE
$$LC{d^2 v_C\over dt^2} + RC {d v_C\over dt} + v_C = v_T(t)\leqno(1)$$
so that these circuits are also described by the harmonic
oscillator equations that we have been studying for the past week.
  We will always consider
a {\it periodic, sinusoidal} voltage source (``forcing'') term
$$v_T(t) = a\sin(\omega t).$$
\bigskip
\noindent
{\it Maple Notes}
\bigskip
All of the plots necessary for this lab will be generated using the
basic Maple {\tt plot} command.  However, if you want to check your
results, you can also use the {\tt DEplot} command from Lab 1 to
plot approximate numerical solutions to 2nd order ODE as follows.
For example, say we want to see the solution of the initial value
problem
$$\cases{ 4{d^2 y\over dt^2} + 3 {dy\over dt} + 10y = 3\cos(2t)\cr
           y(0) = 5\cr
           y'(0) = -3\cr}$$
Then the following commands could be used.  First load the {\tt DEtools}
package with:
\medskip
\centerline{\tt with(DEtools):}
\medskip
\noindent
Then define the ODE with:
\medskip
\centerline{\tt eqn:=4*diff(y(t),t\$2)+3*diff(y(t),t)+10*y(t) = 3*cos(2*t);}
\medskip
\noindent
and plot the solution for $t\in [0,10]$ with
\medskip
\centerline{\tt DEplot(eqn,y(t),t=0..10,[[y(0)=5,D(y)(0)=-3]]);}
\medskip
\noindent
As in Lab 1, adjusting the {\tt linecolor} and {\tt stepsize} options,
the range of $t$-values, etc.
will often be necessary to get reasonable, printable graphs.
\bigskip
\noindent
{\it Lab Questions}
\bigskip
\item{A)} (A worked example)
Suppose we want to understand the voltage in an RLC circuit
with $R = 1000$, $L = 2$, and $C = 10^{-6}$, and a voltage
source $v_T = 20\sin(500 t)$.  We know that
the general solution of (1) in this case:
$$(2\times 10^{-6}){d^2 v_C\over dt^2} + (10^{-3}) {d v_C\over dt} + v_C = 20\sin(50 t)
\leqno(2)$$
looks like $v_C(t) = c_1 v_1(t) + c_2 v_2(t) + v_p(t)$, where 
$c_1 v_1(t) + c_2 v_2(t)$ is the general solution 
for the homogeneous equation
$$(2\times 10^{-6}){d^2 v_C\over dt^2} + (10^{-3}) {d v_C\over dt} + v_C = 0$$
and $v_p(t)$ is any particular solution.
\itemitem{1)}  To find $v_1(t), v_2(t)$, we find the roots of the characteristic
polynomial of the corresponding first order system:
$$(2\times 10^{-6})\lambda^2 + (10^{-3}) \lambda + 1 = 0$$
To find them using Maple, enter:
\bigskip
\centerline{\tt fsolve(2*10\^{}(-6)*lambda\^{}2+10\^{}(-3)*lambda+1,lambda,complex);}
\bigskip
\itemitem{2)}  Call the roots $\alpha \pm i\beta$.
Then we know that the general solution of the homogeneous
equation has the form 
$c_1 e^{\alpha t} \cos(\beta t) + c_2 e^{\alpha t} \sin(\beta t)$.
Define the two terms here as functions in Maple using:
\bigskip
\centerline{\tt v1:= t->exp(alpha*t)*cos(beta*t);}
\centerline{\tt v2:= t->exp(alpha*t)*sin(beta*t);}
\bigskip
\itemitem{} (You will need to assign values to {\tt alpha} and 
{\tt beta} or fill in the correct numerical values.)
\itemitem{3)}  Now, we need to find a particular solution $v_p$.
This is where the method of undetermined coefficients that we discussed
in class earlier comes in.  The $20\sin(50 t)$ term on the right 
means that 
we guess that a particular solution will have the
form $v_p(t) = A\cos(50 t) + B\sin(50 t)$.  (Note, no term here is a
solution of the homogeneous equation, so we {\it do not need a $t^s$
factor, that is, $s = 0$}.)  Plug $v_p(t)$ into (2) and determine the values of 
$A,B$ to yield a solution.  You should get:
$$\eqalign{.995A + .05 B = 0\cr
           -.05A + .995 B = 20\cr}$$
So $A \doteq -1.007$ and $B \doteq 20.05$.
You can find these equations and the solutions in Maple using
\bigskip
\centerline{\tt vp:=t->A*cos(50*t)+B*sin(50*t);}
\centerline{\tt 2.0*10\^{}(-6)*diff(vp(t),t\$2)+1.0*10\^{}(-3)*diff(vp(t),t)+vp(t);}
\centerline{\tt ABSol := fsolve($\{$.995*A+.05*B,-.05*A+.995*B-20$\}$,$\{$A,B$\}$); }
\centerline{\tt vpp := t -> subs(ABSol,vp(t));}
\bigskip
\itemitem{}The last line defines the particular solution
as a new function, with the values of $A,B$ ``plugged in.''
\bigskip
\itemitem{4)}  Now, we find the 
values of $c_1,c_2$ that  give a solution of the
initial value problem with $v(0) = 0$, $v'(0) = 1$.  Here are
some sample Maple commands to work with:
\bigskip
\centerline{\tt vC:=t->c1*v1(t)+c2*v2(t)+vpp(t); }
\centerline{\tt initeqs:=$\{$vC(0)=0,subs(t=0,diff(vC(t),t))=1$\}$; }
\centerline{\tt cvals:=fsolve(initeqs,$\{$c1,c2$\}$); }
\bigskip
\itemitem{5)}  Finally, plot the solution of (2) with 
$v_C(0) = 0$, and $v_C'(0) = 1$. 
(Note:  You'll need to think about an appropriate interval of $t$ values
for your plot.  A term like $\cos(661.437 t)$ is oscillating really fast!)
Also plot the ``transient'' part of the solution separately.
(This should show you why the solution of (2) looks virtually
indistinguishable from a sinusoidal function!)
\bigskip
\item{B)}  Suppose $L,C > 0$, but the resistance $R = 0$.  (This is a very, 
very idealized situation, of course, even better than ``superconductivity.'')  
What do the solutions of (1) look like in this case?  Derive
analytic formulas by our {\it undetermined coefficients} technique 
for inhomogeneous 2nd order
equations.   Be sure to distinguish between the two different cases:
\itemitem{1)}  $i \omega$ {\it is not} a root of the characteristic polynomial, and 
\itemitem{2)}  $i \omega$ {\it is} a root of the characteristic polynomial.
\item{} How is the analytic form of the solution different in these two 
cases?
\bigskip
\item{C)}  Using Maple, plot the analytic solutions of (1) with 
$R = 0$, $C = 10^{-6}$, $L = 1$, $a = 1$, $v_C(0) = 1$, $v_C'(0) = 0$, 
and $\omega = 900, 950, 1000, 1050, 1100$  (five graphs in all).
(You'll need to chose your $t$ interval carefully to get informative graphs!)
The name for the $\omega = 1000$ case is {\it resonance}.  Describe
what a resonant solution does as $t\to\infty$.  Can you think of 
a ``real world'' situation that might correspond to resonance?  Is
it a ``good'' or a ``bad'' thing to have a resonant solution?
\bigskip
\item{D)}  Next, we will study the more realistic case $R > 0$.
By considering the form of the roots of the characteristic
polynomial of the 1st order system, 
show that if $R > 0$, then every solution of the corresponding 
homogeneous equation
$$LC{d^2 v_C\over dt^2} + RC {d v_C\over dt} + v_C = 0$$
tends to {\it zero} as $t\to \infty$.  These terms in the general solution 
of (1) are called ``transients'' for this reason.
\bigskip
\item{E)} Plot and describe the solutions for 
fixed $a =10$ and 
$\omega = 1000,1200,1400,1600,1800,2000$ with
$R = 2000$, $C = 2\times 10^{-7}$, and $L = 1.5$.
How does the amplitude of the steady state solution compare
with the amplitude of the forcing term (as a function of $\omega$)?
Does resonance occur in this situation?  Explain.
\bigskip
\noindent
{\it Assignment}
\bigskip
Individual write-ups giving answers to the above questions.  {\bf Due:}
In class, Friday, November 5. 
\bye
