<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Misc | Nalin Gadihoke</title><link>https://www.nalingadihoke.com/tag/misc/</link><atom:link href="https://www.nalingadihoke.com/tag/misc/index.xml" rel="self" type="application/rss+xml"/><description>Misc</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><copyright>© Nalin Gadihoke, 2020</copyright><lastBuildDate>Wed, 31 Jul 2019 00:00:00 +0000</lastBuildDate><image><url>https://www.nalingadihoke.com/images/icon_huf9971291de093faa6aa59cd65f433195_5940_512x512_fill_lanczos_center_3.png</url><title>Misc</title><link>https://www.nalingadihoke.com/tag/misc/</link></image><item><title>Modelling Radioactive Decay</title><link>https://www.nalingadihoke.com/post/nuclear-modelling/</link><pubDate>Wed, 31 Jul 2019 00:00:00 +0000</pubDate><guid>https://www.nalingadihoke.com/post/nuclear-modelling/</guid><description>&lt;p>&lt;a href="https://en.wikipedia.org/wiki/Radioactive_decay#Mathematics_of_radioactive_decay" target="_blank" rel="noopener">Radioactive decay&lt;/a> is the process by which an unstable atomic nucleus emits radiation such as an alpha particle, beta particle or gamma particle with a neutrino. This process is a good example of exponential decay.&lt;/p>
&lt;p>Consider the case of $N_A$ decaying to $N_B$, $N_A \rightarrow N_B$. In this case decay rate is proportional to number of atoms present $N_A$. Adding, a constant of proportionality or the decay constant, which is unique to every element, we get a general differential equation&lt;/p>
&lt;p>$$\frac{dN_A}{dt} = - \lambda_A N_A$$&lt;/p>
&lt;p>In the case of element $N_A$ decaying to $N_B$ decaying to $N_C$ (stable), $N_A \rightarrow N_B \rightarrow N_C$,&lt;/p>
&lt;pre>&lt;code class="language-mermaid">graph LR;
A--&amp;gt;B;
B--&amp;gt;C;
&lt;/code>&lt;/pre>
&lt;p>the first decay is represented by the above equation however we need a new differential equation for the second decay of $N_B \rightarrow N_C$. Since the number of $N_B$ increases as a result of activity from $N_A$ and decreases due to its own decay into $N_C$, we can form a differential equation as follows&lt;/p>
&lt;p>\begin{equation}
\frac{dN_B}{dt} = - \lambda_B N_B + \lambda_A N_A
\end{equation}&lt;/p>
&lt;p>The creation rate of the stable $N_C$ atoms is simply the activity of $N_B$, considering its independent decay&lt;/p>
&lt;p>\begin{equation}
\frac{dN_C}{dt} = \lambda_B N_B
\end{equation}&lt;/p>
&lt;p>For this model, the following values were assumed:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Command&lt;/th>
&lt;th>Value&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>$t_{halfA}$&lt;/td>
&lt;td>1.1 hours&lt;/td>
&lt;td>time for half of $N_A$ atoms to decay&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>$t_{halfB}$&lt;/td>
&lt;td>9.2 hours&lt;/td>
&lt;td>time for half of $N_B$ atoms to decay&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>$N_A(0)$&lt;/td>
&lt;td>100&lt;/td>
&lt;td>number of atoms of $N_A$ at $t=0$&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>$N_B(0)$&lt;/td>
&lt;td>0&lt;/td>
&lt;td>number of atoms of $N_B$ at $t=0$&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>$N_C(0)$&lt;/td>
&lt;td>0&lt;/td>
&lt;td>number of atoms of $N_C$ at $t=0$&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>$t_{final}$&lt;/td>
&lt;td>50 hours&lt;/td>
&lt;td>time for full simulation&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h4 id="analytical-solutions">Analytical Solutions&lt;/h4>
&lt;p>This approach included solving the first three equations by integrating both sides to find equations for $N_A(t)$, $N_B(t)$ and $N_C(t)$. The first equation was solved to,&lt;/p>
&lt;p>\begin{equation}
N_A(t) = N_A(0)e^{-\lambda_A t}
\end{equation}&lt;/p>
&lt;p>or, the decay constant can be represented as&lt;/p>
&lt;p>\begin{equation}
\lambda_A = \frac{ln2}{t_{half_A}}
\end{equation}&lt;/p>
&lt;p>This formula is later used to calculate $\lambda_A$, $\lambda_B$ and $\lambda_C$&lt;/p>
&lt;p>Similarily, solving the second equation we get&lt;/p>
&lt;p>\begin{equation}
N_B(t) = \frac{N_A(0)\lambda_A}{\lambda_B - \lambda_A} (e^{-\lambda_A t} - e^{-\lambda_B t})
\end{equation}&lt;/p>
&lt;p>and solving the third we get&lt;/p>
&lt;p>\begin{equation}
N_C(t) = N_C(0) + \lambda_B N_B(0) (1 - e^{-\lambda_Bt}) + \frac{N_A(0)}{\lambda_B - \lambda_A} (\lambda_B(1 - e^{-\lambda_A t}) - \lambda_A(1 -e^{-\lambda_B t}))
\end{equation}&lt;/p>
&lt;p>where values of $N_A(0)$, $N_B(0)$ and $N_C(0)$ are assumed as initial parameters and $\lambda_B$ is calculated similarly to $\lambda_A$ for which the values of $t_{half}$ is taken from the above table.&lt;/p>
&lt;h4 id="numerical-solutions">Numerical Solutions&lt;/h4>
&lt;p>Here, the finite difference approach was used in computing the values for $N_A(t+\delta t)$, $N_B(t+\delta t)$ and $N_C(t+\delta t)$ which are essentially the values of $N_A(t)$, $N_B(t)$ and $N_C(t)$ for every time step given an initial $N_A(0)$, $N_B(0)$ , $N_C(0)$ and $\delta t$. By definition, a derivative is&lt;/p>
&lt;p>$$ \frac{df}{dt} = \lim_{\delta t \rightarrow 0 } \frac{f(x+\delta t)-f(x)}{\delta t}$$&lt;/p>
&lt;p>Applying this to the first three differential equations we get&lt;/p>
&lt;p>$$\frac{N_A(t+\delta t)-N_A(t)}{\delta t} = - \lambda_A N_A(t)$$&lt;/p>
&lt;p>$$\frac{N_B(t+\delta t)-N_B(t)}{\delta t} = - \lambda_B N_B(t) + \lambda_A N_A(t)$$&lt;/p>
&lt;p>$$\frac{N_C(t+\delta t)-N_C(t)}{\delta t} = \lambda_B N_B(t) $$&lt;/p>
&lt;p>re-arranging,
\begin{equation}
N_A(t+\delta t) = - \lambda_A N_A(t)\delta t + N_A(t)
\end{equation}
\begin{equation}
N_B(t+\delta t) = (- \lambda_B N_B(t) + \lambda_A N_A(t))\delta t + N_B(t)
\end{equation}
\begin{equation}
N_C(t+\delta t) = \lambda_C N_C(t)\delta t + N_C(t)
\end{equation}
It is to be noted that three different values of $\delta t$ were considered, 1 hour, 0.5 hours and 0.25 hours, and their impacts on the model were mainly in increasing the granularity (smoothness) of the different curves.&lt;/p>
&lt;p>Lastly, the above equations just need to be converted into numpy arrays.&lt;/p>
&lt;pre>&lt;code class="language-sh">na[i] = (- lambda_list[0] * na[i-1] * t_del) + na[i-1]
nb[i] = ((-lambda_list[1]*nb[i-1]) + (lambda_list[0]*na[i-1]))*t_del
+ nb[i-1]
nc[i] = (lambda_list[1]*nb[i-1]*t_del) + nc[i-1]
&lt;/code>&lt;/pre>
&lt;p>To iteratively acheive this, these were then programmed as a function $numerical$ which accepts lists of $N(0)$ and $\lambda$ values and $\delta t$ and outputs a list whose elements are the arrays $N_A(t)$, $N_B(t)$, $N_C(t)$ and $t$ (which contains the time values used for plotting), based on the code below. The core equations were modeled as follows between $t = 0\ to\ t_{final}$ with $\frac{t_{final}}{\delta t}$ time steps. The final graph is shown below. Notice how $N_A$ decays considerably faster than $N_B$ which is in line with the half-life assumptions.&lt;/p>
&lt;figure >
&lt;a data-fancybox="" href="https://www.nalingadihoke.com/post/nuclear-modelling/main_hu0329da069351594603a65a0c27cc0ba1_44580_2000x2000_fit_lanczos_3.png" >
&lt;img data-src="https://www.nalingadihoke.com/post/nuclear-modelling/main_hu0329da069351594603a65a0c27cc0ba1_44580_2000x2000_fit_lanczos_3.png" class="lazyload" alt="" width="800" height="600">
&lt;/a>
&lt;/figure></description></item><item><title>Modelling Radioactive Decay</title><link>https://www.nalingadihoke.com/project/nuclear-modelling/</link><pubDate>Wed, 31 Jul 2019 00:00:00 +0000</pubDate><guid>https://www.nalingadihoke.com/project/nuclear-modelling/</guid><description/></item></channel></rss>