Practice Problems for CBNM Lab Exam


These problems provide a checkpoint for all the code you have written in the labs so far. Make sure you can solve these problems with your code. The examination will have problems that will use these practice problems as a base. They may require you to combine solutions from multiple problems, analyse the results and work out small deviations from the types we have done until now.

  1. The number 1,000,000,064.0 is stored in 32-bit IEEE floating point format. What is its binary representation in IEEE floating point format? Clearly indicate the sign-bit, mantissa and exponents.

    What is the next number that can be represented in the 32-bit floating point format?

    Discuss with your friends whether you can represent any real number in the billions with this format.

  2. What is the value of the function $y2 = 3.2x^2 - 4x + 1.9$ at the point $x_0$ where the function $y1 = 9.8x^3 - 15.26$ cuts the $x$-axis?
  3. Given the following data points, fit the function $$ y = c_0\sqrt{x} + c_1\cos(x)\sin(x) $$ through them. $$ \begin{array}{|l|rrrrrrrrrr|} \hline x & 1.0 & 1.5 & 2.0 & 2.5 & 3.0 & 3.5 & 4.0 & 4.5 & 5.0 & 5.5 \\ \hline y & 5.19 & 4.33 & 1.84 & 2.0 & 4.79 & 7.38 & 8.13 & 6.77 & 5.67 & 4.14 \\ \hline \end{array} $$
  4. Use the Jacobi Method to solve the following system of equations. $$ \begin{eqnarray} 15.38x_1+5.79x_2+1.83x_3+2.06x_4+2.53x_5 & = & 61.34 \\ 6.44x_1+14.87x_2+3.22x_3+2.68x_4+7.33x_5 & = & 105.35\\ 5.17x_1+1.80x_2+12.08x_3+5.9x_4+0.59x_5 & = & 82.31 \\ 1.01x_1+0.58x_2+5.16x_3+15.85x_4+2.42x_5 & = & 107.15\\ 1.84x_1+4.2x_2+1.18x_3+4.46x_4+15.63x_5 & = & 126.23 \end{eqnarray} $$
  5. Solve the system of equations in the previous problem using Gauss Elimination. Did you get the same answers (to the third decimal place)?
  6. Interpolate the value of $f(2.6)$ given the following data points. Use both Linear and Lagrange interpolations. Which method, do you think, gives a more believable value?
    $(0.5, 2.8), (1.0, 3.9), (1.5, 2.1), (2.0, 6.0), (2.5, 6.6), (3.0, 7.0)$
  7. Find the area under the curve given by the data points from the previous question. Use trapezoidal and Simpson's rules. Is there any difference in the areas? Discuss with your friends and try to explain your answer(s).
  8. Solve the following ODE using Euler method for $x(1.8)$ with $\Delta{t}=0.01$ given that $x(0) = \frac{2}{3}$. $$ \frac{dx}{dt} = 3x + 4t $$ What do you get if $\Delta{t}=0.001$? Use RK-4 method with $\Delta{t}=0.1$. If the correct value is $244.05$, you can see why RK-4 is so popular.


Answers (not complete!)

  1. 1,000,000,064.0 = 01001110011011100110101100101001
    Next Number: 1,000,000,128.0
  2. $x(1.159) = 1.563$
  3. $y = 2.9\sqrt{x} + 5.1\cos(x)\sin(x)$
  4. $x_1, x_2, x_3, x_4, x_5 = 1.15, 2.3, 3.45, 4.6, 5.75$
  5.  
  6. $f(2.6) = 6.04$ (Lagrange); $f(2.6) = 6.68$ (Linear)
  7.  
  8.