Mandatory Problem M-7 The rate of radioactive decay of a particular substance ca
ID: 2971138 • Letter: M
Question
Mandatory Problem M-7
The rate of radioactive decay of a particular substance can be described by the following
equation:
dy/dt = -ry
where:
y = mass of material
t = time
r = rate constant
Calculate the mass of material at the time periods of 25 , 50 , 75 , and 100 days with
methods noted below, under these conditions:
mass = 200 gms when t = 0 (initial conditions)
choose a value of r (rate constant ) that is somewhere in the range of .01 to .03 . Use the
same value through the entire problem. This will give you a valid comparison of methods.
1. Euler's method (1st order Runge-Kutta)
2. Improved or Modified Euler's method , your choice (2nd order Runge-Kutta)
3. 4th order Runge-Kutta
4. Closed form solution. This differential equation is solvable, so you will be able to see
how the exact solution compares with your numerical solutions from steps 1
Explanation / Answer
MATLAB CODE:
function [y]=masscalc()
x=0:25:100;
h=25;
r=0.02;
y1(1)=200;
y2(1)=200;
y3(1)=200;
y4(1)=200;
for i=1:length(x)-1
y1(i+1)=y1(i) - h*r*y1(i);
a=y1(i+1);
b=a+2;
while(b-a>10^-5)
b=y2(i) - h*r*b;
a=b;
end
y2(i+1)=b;
k1=-1*r*y3(i);
k2=-1*r*(y3(i)+0.5*h*k1);
k3=-1*r*(y3(i)+0.5*h*k2);
k4=-1*r*(y3(i)+h*k3);
y3(i+1)=y3(i)+(h/6)*(k1+2*k2+2*k3+k4);
y4(i+1)=200*exp(-1*r*x(i+1));
end
disp('Euler');
disp(y1);
disp('2nd order Runge kutta');
disp(y2);
disp('Runge 4th order');
disp(y3);
disp('Exact');
disp(y4);
%End of code-------------------------------------
y1--------- Euler
y2--------- Runge kutta 2nd order
y3---------Runge kutta 4th order
y4---------Exact
Solution:
Euler
200.0000 100.0000 50.0000 25.0000 12.5000
2nd order Runge kutta
200.0000 149.0000 123.0000 109.5000 102.2500
Runge 4th order
200.0000 121.3542 73.6342 44.6791 27.1100
Exact
200.0000 121.3061 73.5759 44.6260 27.0671