Review - test exam, PHY201
- Spring 2012


Write well commented and structured C++ code to do the following. You are encouraged to refer to and use any useful parts of the code you developed in worksheets 1->4.
The lab exam will be like this - you will have 1 hr
The lab exam is scheduled for 8:10-9:10pm Thursday April 27th
Let us know if you can't make it


PROBLEM 1. Find and print the sum of the first 200 integers.

PROBLEM 2. Use the trapezoid rule to evaluate the integral.

\begin{displaymath}\int_0^1 x^{1/2} e^{-x} dx
\end{displaymath} (1)


PROBLEM 3. Find the product of two matrices:

\begin{displaymath}A = \{\{1,2,3\},\{2,3,5\},\{3,4,6\}\}
\end{displaymath} (2)

and,

\begin{displaymath}B = \{\{2,3,4\},\{3,5,6\},\{4,5,6\}\}
\end{displaymath} (3)

PROBLEM 4. Use the Runga Kutta code you developed to integrate the equation

\begin{displaymath}{d^2 x(t) \over dt^2} + b {dx(t)\over dt} + \omega^2 x(t) = f(t)
\end{displaymath} (4)

over a timespan of 10 seconds, for the case b=0.01, $\omega=1$, f(t) = Sin(t). Plot your result using xmgrace. Can you give a physical meaning to this equation and to b, $\omega$ and f(t)?