Project 7

Problem 1

Part 1

According to quantum mechanics, the ground state of a particle in a spherical well is determined by the system of nonlinear equations:

\begin{align*} \frac{x}{\tan(x)} &= -y \, ,\\ x^2 + y^2 &= s^2 \, , \end{align*}

where $s$ depends on the mass and radius of the particle and the strength of the potential. In appropriate units, $s=3.5$. Use any method of your choice ot solve this nonlinear system.

Part 2

The first excited state of the particle is determined by the nonlinear system:

\begin{align*} \frac{1}{x\,\tan(x)} - \frac{1}{x^2} &= \frac{1}{y} + \frac{1}{y^2} \, ,\\ x^2 + y^2 &= s^2. \end{align*}

Again, use any method of your choice to solve this nonlinear system.

Problem 2

Bioremediation involves the use of bacteria to consume toxic wastes. At steady state, the bacterial density $x$ and nutrient concentration $y$ satisfy the system of nonlinear equations:

\begin{align*} \gamma x y -x(1+y) &= 0 \,, \\ -xy + (\delta-y)(1+y) & = 0 \,, \end{align*}

where $\gamma$ and $\delta$ are parameters that depend on various physical features of the system; typical values are $\gamma=5$ and $\delta=1$. Solve this system numerically using any method. You should find at least one solution with a nonzero bacterial density $(x\not=0)$, and one solution in which the bacterial population has died out $(x=0)$.

Problem 3

Lorenz derived a simple system of ordinary differential equations describing buoyant convection in a fluid as a crude model for atmospheric circulation. At steady state, the convective velocity $x$, temperature gradient $y$, and heat flow $z$ satisfy the system of nonlinear equations:

\begin{align*} \sigma (y-x) &= 0 , \\ r x - y -x z &= 0 , \\ x y - b z &= 0 , \end{align*}

where $\sigma$ (the Prandtl number), $r$ (the Rayleigh number), and $b$ are positive constants that depend on the properties of the fluid, the appplied temperature gradient, and the geometry of the problem. Typical values Lorenz used are $\sigma = 10$, $r = 28$, and $b= 8/3$. Write a program using any nonlinear solver to solve this system of equations. You should find three different solutions.

Problem 4

If an amount $a$ is borrowed at interest rate $r$ for $n$ years (compunded annually), then the total amount to be repaid is given by $a(1+r)^n$.

  1. If a payment of $p$ is made each year, what is the balance of the loan at the end of year $k$?
  2. For a loan of $a=\,$\$100,000 and yearly payments of $p=\,$ \$10,000, how long will it take to pay off the loan if the interest rate is 6 percent, i.e., $r=\,$ 0.06?
  3. For a loan of $a=\,$ \$100,000 and yearly payments of $p=\,$ \$10,000, what interest rate $r$ would be required for the loan to be paid off in $n=\,$20 years?
  4. For a loan of $a=\,$ \$100,000, how large must the yearly payments $p$ be for the loan to be paid off in $n=\,$ 20 years at 6 percent interest?

You may use any method you like to solve the given equation in each case. For the purpose of this problem, we will treat $n$ as a continuous variable (i.e., it can have fractional values)

Problem 5

Write a program to find a minimum of Rosenbrock's function,

$$ f(x,y) = 100(y-x^2)^2 + (1-x)^2\, . $$

This function and its Jacobian and Hessian is available in scipy.optimize as rosen, rosen_der and rosen_hes.

Part 1

Draw a contour plot of the function.

Part 2

Use the minimize function in scipy.optimize and use 5 different methods in turn, by setting argument method to Neldor-Mead, Powell, CG, BFGS, and Newton-CG.

You should try each of the methods from each of the three startings points $(-1, 1)$, $(0,1)$, and $(2,1)$.

Part 3

Plot the path taken in the plane by the approximate solutions for each method from each starting point. Make this plot overlaid on a countour plot of the function.

Problem 6

A bacterial population $P$ grows according to the geometric progression:

$$ P_k = r P_{k-1}\, , $$

where $r$ is the growth rate. The following population counts (in billions) are observed:

$$ \begin{array}{c|cccccccc} \mathbf{k} & \mathbf{1} & \mathbf{2} & \mathbf{3} & \mathbf{4} & \mathbf{5} & \mathbf{6} & \mathbf{7} & \mathbf{8} \\ \hline \mathbf{P_k} & 0.19 & 0.36 & 0.69 & 1.3 & 2.5 & 4.7 & 8.5 & 14 \end{array} $$

Part 1

Perform a nonlinear least squares fit of the growth function to these data to estimate the initial population $P_0$ and the growth rate $r$.

Part 2

By using logarithm, a fit ot these data can also be done by linear least squares. Perform such a linear least squares fit to obtain estimates for $P_0$ and $r$, and compare your results with those for the nonlinear fit.


The problems in this project are based on problems from Scientific Computing by Michael T. Heath.