PART 1: Consider a radioactive decay problem involving two types of nuclei, A and B,…
- User
PART 1: Consider a radioactive decay problem involving two types of nuclei, A and B, with populations Na(t) and Nb(t). Suppose that type A nuclei decay to form type B nuclei, which then decay, according to the differential equations: dNa(t) / dt = -Na(t) / Ta dNb(t) / dt = [Na(t) / Ta] - [Nb(t) / Tb]
where Ta and Tb are the decay time constants for each type of nucleus. Specify the units of time that you are using. Although these decay time constants are arbitrary, for you to specify, they should have the correct order of magnitude. You can find this by doing a quick search over the internet. Next, use the Euler method to solve these coupled equations for Na and Nb as a function of time. This will require writing a MATLAB script. Plot the results and upload your MATLAB script that does this calculation.
ANSWER TO PART 1:
%% Parameters Ta = 1; % decay time constant for Type A nucleus (s) Tb = 100; % decay time constant for Type B nucleus (s) dt = 1; % time step size (s) tFinal = 3000; % end time (s)
%% Initial values t = zeros(1, tFinal/dt+1); Na = zeros(1, tFinal/dt+1); Nb = zeros(1, tFinal/dt+1);
t(1) = 0; Na(1) = 1000; % initial population of Type A nucleus Nb(1) = 0; % initial population of Type B nucleus
%% Euler's method for i=1:(tFinal/dt) t(i+1) = t(i) + dt;
dNa_dt = -Na(i)/Ta; % rate of change of Type A nucleus population dNb_dt = (Na(i)/Ta) - (Nb(i)/Tb); % rate of change of Type B nucleus population
Na(i+1) = Na(i) + dNa_dtdt; % update Type A nucleus population Nb(i+1) = Nb(i) + dNb_dtdt; % update Type B nucleus population end
% Reference: Euler method from part1 %{ t = zeros(numSteps+1,1); v = zeros(numSteps+1,1); exactV = zeros(numSteps+1,1);
t(1) = to; v(1) = v0; exactV(1) = v0;
for i = 1:numSteps t(i+1) = t(i) + dt; v(i+1) = v(i) - gdt; exactV(i+1) = v0 - g(i*dt); end %}
%% Plot results plot(t, Na, 'r'); hold on; plot(t, Nb, 'b'); hold off; xlabel('Time (s)'); ylabel('Population'); legend('Type A', 'Type B'); grid on;
% Time units: seconds. The decay time constants Ta and Tb can be specified % according to the actual problem or chosen arbitrarily.
PART 2: These equations can be solved exactly. Work out the exact solution for Na and Nb as a function of time. Look at how the choice of your δ𝑡 for numerical integration effects the accuracy of the numerical predictions.
PART 3: Assuming Ta and Tb are not very similar, numerically solve the nuclear-decay equations for the two nuclei using the expm() function in MATLAB. Verify that this way of solving the equations is in agreement with Euler’s method of PART 1 and the exact solution of PART 2.
Find answer for PART 2 and PART 3
- Assistant
PART 2: To find the exact solution for Na and Nb as a function of time, we can solve the differential equations by separation of variables.
Starting with the equation for dNa(t)/dt: dNa(t)/dt = -Na(t)/Ta
Rearranging the equation and integrating both sides: 1/Na(t) * dNa(t) = -1/Ta * dt
Integrating again: ∫ (1/Na(t) * dNa(t)) = ∫ (-1/Ta * dt)
- User
Write a MatLab code to answer PART 3
- Assistant
%% Parameters Ta = 1; % decay time constant for Type A nucleus (s) Tb = 100; % decay time constant for Type B nucleus (s) dt = 1; % time step size (s) tFinal = 3000; % end time (s)
%% Initial values t = 0:dt:tFinal; N0 = [1000, 0]; % initial population of Type A and Type B nuclei
%% Solve using expm() A = [-1/Ta, 0; 1/Ta, -1/Tb]; N_exp = zeros(length(t), 2); N_exp(1, :) = N0;
for i = 2:length(t) N_exp(i, :) = expm(A * t(i)) * N0'; end
%% Euler's method (for comparison) Na = zeros(1, length(t)); Nb = zeros(1, length(t)); Na(1) = N0(1); Nb(1) = N0(2);
for i = 1:(length(t)-1) dNa_dt = -Na(i)/Ta; dNb_dt = (Na(i)/Ta) - (Nb(i)/Tb);
Na(i+1) = Na(i) + dNa_dt * dt; Nb(i+1) = Nb(i) + dNb_dt * dt;end
%% Plot results plot(t, N_exp(:, 1), 'r'); hold on; plot(t, N_exp(:, 2), 'b'); plot(t, Na, 'g--'); plot(t, Nb, 'm--'); hold off;
xlabel('Time (s)'); ylabel('Population'); legend('Type A (expm)', 'Type B (expm)', 'Type A (Euler)', 'Type B (Euler)'); grid on;
% Verify agreement with Euler's method and the exact solution.