$30
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.
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)=c0+c1x+c2x2+c3x3 with the coefficients specified as numeric values with three digits.
Problem 2. Exponential fit
(a) Given the following experimental measurements of alpha-particle emission of a radioactive substance, fit an exponential function y=cexp(at) 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 ?
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;
(b) What is the substance's half-life? (i.e. the time t for which y(t)=0.5y(0) .
Problem 3. Power-law fit
(a) Fit a power-law curve y=cta to the following data, and make a plot showing the datapoints as dots and the fit as a smooth curve.
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=cta as an explicit function in Julia with c and a specified as numeric values with three digits. E.g. P(t) = 4.32 t^5.19.
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=cteat to the data using least squares. Make a plot that shows the data as dots and the exponential fit as a smooth curve.
tdata = [4, 8, 12, 16, 20, 24]; # time in hours
ydata = [21, 31, 25, 21, 15, 16]; # concentration in ng/ml;
(b) Write out the model y=cteat as an explicit function in Julia with numeric values specified to three digits.
(c) Based on the model, at what time do you expect the concentration to reach 5 ng/ml?