Numerical analysis final proect

In this 40 point final project, you'll solve 4 fairly basic problems from scratch using Python in the Jupyter notebook.

  • The notebook is due to me via email this Friday, April 29 at 5:00 PM.
  • I expect a moderate level of exposition in the notebook. Use of markdown, latex, and sections will be required for a good score.
  • You may consult
    • Our class webpage (I think that problems similar to all of these are on there somewhere)
    • Our text book
    • Any other webpage or text book
  • You may not, however, ask specific questions of others including
    • Your classmates
    • Your roommates
    • Your housemates
    • Other people, for that matter
    • Stack type sites
    • Things that respond to questions of any sort

Have fun!

Problem I

Let $n$ be an integer larger than $1$. In this problem, we'll explore the system $$ \begin{align} 10^{-n}x + y &= 1 \\ x + y &= 2. \end{align} $$

  1. Solve the system by hand with and without pivoting. Use LaTeX to put your results in the notebook. (You don't need to type out your whole solution - just the answers.)

  2. Set $n=12$ and evaluate the expressions that you obtain for $x$

  3. Which result is better and why?

Problem II

Find a least squares fit to the data $$\{(-1,0),(0,1),(1,1/2)\}$$ using a function of the form $f(x)=a+b\cos(x)$. Plot the result with the data.

Problem III

Estimate the solution to the IVP $y' = y(10-y)$; $y(0)=1$ over the time interval $0\leq t \leq 1$ using odeint and plot the result.

Problem IV

Let $f$ be the function that interpolates the following data of $x$ and $y$ coordinates, as given by interp1d.

In [ ]:
xs,ys = (
    [0.00421211,  0.05669495,  0.06117997,  0.18771917,  0.26872849,
     0.45752444,  0.51013805,  0.86553414,  0.89077439,  0.89898213,
     0.99087017,  1.30318595,  1.44308006,  1.52456016,  1.52754924,
     1.5774467 ,  1.67153021,  1.69486747,  1.80285492,  1.89054139],
    [1.0,  0.99999483,  0.999993  ,  0.99937919,  0.99739363,
     0.97817065,  0.96632804,  0.73226845,  0.70136973,  0.69082354,
     0.55550704, -0.12715214, -0.48964603, -0.68418628, -0.69081117,
     -0.79410997, -0.94019997, -0.96403265, -0.99409871, -0.90789806])

If $b$ denotes the smallest positive root of $f$, compute $$\int_0^b f(x) dx.$$