Math 753/853 HW5: Least-squares fits to models

Problem 1. Polynomial least-squares fit

(a) Fit a cubic polynomial to the following data, and make a plot that shows the data as dots and the cubic fit as a smooth curve.

In [9]:
xdata = [-1.0  -0.8  -0.6  -0.4  -0.2  0.0  0.2  0.4  0.6  0.8  1.0];
ydata = [3.41  3.19  2.57  2.44  1.90 1.66 1.17 1.46 1.07 1.44 2.28];

(b) Write out the polynomial in the form $P(x) = c_0 + c_1 x + c_2 x^2 + c_3 x^3$ with the coefficients specified as numeric values with three digits.

In [ ]:

Problem 2. Exponential fit

(a) Given the following experimental measurements of alpha-particle emission of a radioactive substance, fit an exponential function $y = c \exp(a t)$ to the data using least squares. Make a plot that shows the data as dots and the exponential fit as a smooth curve. What are the values of $c$ and $a$?

In [8]:
tdata = [0   4  8 12 16 20 24 28 32 36 40 44 48]; # time in hours
ydata = [69 64 54 41 44 34 26 29 18 22 18 19 11]; # alpha particle emission rate
Out[8]:
1×13 Array{Int64,2}:
 69  64  54  41  44  34  26  29  18  22  18  19  11

(b) What is the substance's half-life? (i.e. the time $t$ for which $y(t)/y(0) = 1/2$)

In [ ]:

Problem 3. Power-law fit

(a) Fit a power-law curve $y = c t^a$ to the following data, and make a plot showing the datapoints as dots and the fit as a smooth curve.

In [11]:
tdata =  [   2    3    4    5    6    7    8    9   10]; 
ydata =  [12.7 11.2 8.99 8.62 8.12 8.47 7.39 7.24 6.99];

(b) Write out the least-squares power-law fit $y = c x t^a$ with $c$ and $a$ specified as numeric values with three digits.

In [ ]:

Problem 4. c t exp(at) fit

(a) The following data represent measurements of blood concentration of a drug after intravenous injection as a function of time. Fit a function of the form $y = c \, t \, e^{at}$ to the data using least squares. Make a plot that shows the data as dots and the exponential fit as a smooth curve.

In [12]:
tdata = [4   8  12  16  20  24]; # time in hours
ydata = [21 31  25  21  15  16]; # concentration in ng/ml
Out[12]:
1×6 Array{Int64,2}:
 21  31  25  21  15  16

(b) Write out the model $y = c \, t \, e^{at}$ with numeric values specified to three digits.

In [ ]:

(c) Based on the model, at what time do you expect the concentration to reach 5 ng/ml?

In [ ]: