linear algebra least square Suppose radioactive substances R
linear algebra, least square
Suppose radioactive substances R and S have decay constants of.02 and.07, respectively. If a mixture of these two substances at time t = 0 contains M_R grams of R and M_s grams of S, then a model for the total amount A of the mixture at time t is A = M_R e^-.02t + M_s e^-.07t The quantities M_R and M_s are unknown but a scientist takes measurements at several points in time given in the table below. t A 10 21. 34 11 20. 68 12 20. 05 14 18. 87 15 18. 30 Set up a linear model to estimate M_R and M_s. Find the least-squares curve based on (a).Solution
Solution :
First of all summarize what you have using the given equation.
Time Amount e^(-0.02*t) e^(-0.07*t)
10 21.34 0.818730753 0.496585304
11 20.68 0.802518798 0.463013068
14 18.87 0.755783741 0.375311099
15 18.3 0.740818221 0.349937749
Using the form of the equation:
21.34 = M_R*0.818730753 + M_S*0.496585304
20.68 = M_R*0.802518798 + M_S*0.463013068
18.87 = M_R*0.755783741 + M_S*0.375311099
18.3 = M_R*0.740818221 + M_S*0.349937749
You now want to fit this data with the given curve.
That means you want to minimize the error E = SUM[a(i) - A]^2
You do this by setting up the equation for E and take the derivative and set equal to zero.
Since there are two variables, M_r and M_s, you need to use partial derivatives.
I will use m = M_r and n = M_s
(i) = the measured values of a
t(i) = the measured time values
p(i) = e^[-0.02*t(i)]
s(i) = e^[-0.07*t(i)]
A = calculated value from the observations = m*p(i) + n*s(i)
E = SUM[a(i) -A]^2 = SUM[a(i)^2] - 2*SUM[A*a(i)] + SUM[A^2]
E = SUM[a(i)^2] - 2*SUM{[m*p(i) + n*s(i)]*a(i)} + SUM{[m*p(i) + n*s(i)]^2}
Take the partial derivative with respect to m and set equal to 0.
0 = -2*SUM[p(i)*a(i)] + 2*SUM{p(i)*[m*p(i) + n*s(i)]}
0 = -SUM[p(i)*a(i)] + SUM{p(i)*[m*p(i) + n*s(i)]}
0 = -SUM[p(i)*a(i)] + SUM{m*[p(i)]^2} + n*SUM{p(i)*s(i)}
m = {SUM[p(i)*a(i)] - n*SUM{p(i)*s(i)}/SUM{[p(i)]^2}
Now take the partial derivative with respect to n and set equal to 0.
0 = -2*SUM[s(i)*a(i)] + 2*SUM{s(i)*[m*p(i) + n*s(i)]}
0 = -SUM[s(i)*a(i)] + SUM{s(i)*[m*p(i) + n*s(i)]}
0 = -SUM[s(i)*a(i)] + SUM{m*s(i)*p(i)} + n*SUM{[s(i)]^2}
n*SUM{[s(i)]^2} = SUM[s(i)*a(i)] - m*SUM[s(i)*p(i)]
Now use the equation for m and solve for n.
n*SUM{[s(i)]^2} = SUM[s(i)*a(i)] - SUM[s(i)*p(i)]*{SUM[p(i)*a(i)] - n*SUM{p(i)*s(i)}/SUM{[p(i)]^2}
n*SUM{[s(i)]^2}*SUM{[p(i)]^2} = SUM[s(i)*a(i)]*SUM{[p(i)]^2} - SUM[s(i)*p(i)]*{SUM[p(i)*a(i)] - n*SUM[p(i)*s(i)]
n*SUM{[s(i)]^2}*SUM{[p(i)]^2} = SUM[s(i)*a(i)]*SUM{[p(i)]^2} - SUM[s(i)*p(i)]*SUM[p(i)*a(i)] + n*{SUM[p(i)*s(i)]}^2
n*SUM{[s(i)]^2}*SUM{[p(i)]^2} - n*{SUM[p(i)*s(i)]}^2 = SUM[s(i)*a(i)]*SUM{[p(i)]^2} - SUM[s(i)*p(i)]*SUM[p(i)*a(i)]
A p=e^(-0.02*t) s=e^(-0.07*t) SUM(a*p) SUM(a*s) SUM(p^2) SUM(s^2) SUM(p*s)
21.34 0.818730753 0.496585304 17.47171427 10.59713038 0.670320046 0.246596964 0.40656966
20.68 0.802518798 0.463013068 16.59608874 9.575110253 0.644036421 0.214381101 0.371576691
18.87 0.755783741 0.375311099 14.2616392 7.082120435 0.571209064 0.140858421 0.283654026
18.3 0.740818221 0.349937749 13.55697344 6.403860809 0.548811636 0.122456428 0.259240261
SUM{[s(i)]^2} = 0.724292915
SUM{[p(i)]^2} = 2.434377167
SUM[p(i)*s(i) = 1.321040638
SUM{[s(i)]^2}*SUM{[p(i)]^2} - {SUM[p(i)*s(i)]}^2 = 0.018053766
SUM[s(i)*a(i)] = 33.65822188
SUM{[p(i)]^2} = 2.434377167
SUM[s(i)*p(i)] = 1.321040638
SUM[p(i)*a(i)] =61.88641565
SUM[s(i)*a(i)]*SUM{[p(i)]^2} - SUM[s(i)*p(i)]*SUM[p(i)*a(i)] = 0.182336817
n = 0.182336817/0.018053766 = 10.09965523
So M_s is approximately 10.1
I will let you find M_r (it will be around 20 or so maybe)

