# Project 3: Taylor Series

In this project, we will be analyzing the motion of nitrogen atoms in a nitrogen molecule using analytical approximation (Taylor Series) to the Morse Potential and the Heun Method. We need to show that the result of the motion is valid in all methods. Comparing the value of frequency gotten from each method we found out they were about the same values. Frequency from the Experimental model, Taylor expansion, and Heun's method were found to be $5.19\times 10^{13}$ Hz, $5.19\times 10^{13}$ Hz, and $5.13\times 10^{13}$ Hz respectively.

## Description

Taylor series is a series expansion function of a real function about a point. A one-dimensional Taylor series is an expansion of a real function, $f(x)$, about a point $x = x*0$ is given by $$f(x) = f(x_0) + {f}'(x_0)(x - x_0) + \frac{{f}''(x_0)(x - x_0)^2}{2!} + \frac{{f}'''(x_0)(x - x_0)^3}{3!} + \cdots $$ As this goes on, the Taylor series can be seen as:
$$f(x) = \sum*{n=0}^{n=\infty} \frac{f^{(n)}(x_0)}{n!}(x-x_0)^n$$

## Algorithm and Discussion

We will use the Taylor series and Heun's method concept to analyze the motion of nitrogen atoms in a nitrogen molecule. The atoms live in an attractive potential, Morse Potential, of the form:
$$U(x) = U_m \left( \left(1-e^{-\alpha(x-x_0)}\right)^2 - 1\right)$$

The first two terms of the Taylor expansion are not needed in our calculation because at equilibrium position, $x_0$, they end up as zero. The expansion term which is of importance is the third one, the subsequent terms can be negligible because we are dealing with small amplitudes.

Both angular frequency and frequency can be related with the formula $$ f = \frac{\omega}{2\pi} $$.
The second part of the project simulates and analyzes the S.H.M of the atoms in the molecule using Heun's method. It has a general formula: $$s_3 = s_1 + \frac{1}{2}(f_1 + f_2) \Delta x$$ Heun's method involves evaluating the slope, $f(s,x)$, at $s_0$, extrapolating out to $x_1 + \Delta x$, finding $s_1$, using the value of $s_1$ evaluate the slope, $f(s_1,x_1)$. One would notice that the value of the first slope underestimated the change in s, while the value of the second slope overestimated the change in s. Heun's method requires you to find the average of these slopes and use it to find the actual next value of s.
This method is accurate for lower amplitude motion, but gets less accurate and inconsistentt with larger amplitudes. Therefore we use lower amplitudes to validate the Heun's method.
All these are shown in the Implementation and code section below.

The spring constant k, is equal to the second derivative of the Morse potential function evaluated at the equilibrium position. $$ \frac{k(x - x_0)^2}{2} = \frac{{f}''(x_0)(x - x_0)^2}{2!} $$ $$k = {f}''(x_0) $$ Where $$ {f}''(x_0) = 2Um\alpha^2 $$

The (effective) mass of a nitrogen atom is 7.0035 amu. We can derive the angular frequency and linear frequency by using the formula gotten from S.H.M concepts where $$ \omega = \sqrt\frac{k}{m} $$ $\omega$ = Angular frequency. Angular frequency and frequency can be related with the formula $$ f = \frac{\omega}{2\pi} $$. Period = $$ \frac{1}{Frequency} $$

### Analyzing using Heun's Method

Using the amplitudes below, we analyzed the motion of the atoms

$ X*0 = 1.2\times 10^{-10} $ and $ X_1 = 1.23\times 10^{-10} $ and $X_2 = 1.8\times 10^{-10}$
Applying the concept of coupled equations. Where the state is defined as not just the velocity, but both the velocity and the position. Position and the velocity are related by yet another first order differential equation:
$$\frac{dy}{dt} = v$$
$$\frac{dv}{dt} = \frac{f}{m} = \frac{2 Um \alpha \left(1 - e^{- \alpha \left(x - x*{0}\right)}\right) e^{- \alpha \left(x - x_{0}\right)}}{m} $$

## Implementation and code

At small amplitudes, Heun's method's result for frequency is close to the frequency gotten from Experimental analysis and the Taylor expansion of the Morse Potential. At higher amplitude, the Heun's method gives an inaccurate value for frequency as the motion can't be modelled and regarded as Simple Harmonic Motion anymore. At higher amplitude, atoms would take more time to complete a to-and-fro vibrational motion.

Comparing the frequency of the low amplitude at $ 1.23\times 10^{-10} $ and the higher amplitude at $ 1.8\times 10^{-10} $, we see that when we have a high amplitude, the frequency increases because the number of oscillations/period $(T)$ is lower with a higher amplitude, and if $T$ decreases, then the frequency $(f = \frac {1}{T})$ will therefore increase which shows that our result is appropriate.

Also while comparing the frequency gotten using the Heun method at low amplitude and the Taylor Series approximation ($f = \frac{1}{2\pi}\sqrt{k/m}$), we saw that they were close together with values of $ 5.13\times 10^{13} $ and $ 5.19\times 10^{13} $.

## Conclusion

In this project, we analyzed the motion of nitrogen atoms in a nitrogen molecule using experimental data, analytical approximation (Taylor Series) to the Morse Potential and the Heun Method. We wanted to show that the results were consistent with all methods. We did this by comparing the value of frequency gotten from each method and we found out they were about the same values. Frequency from the Experimental model, Taylor expansion, and Heun's method were found to be $5.19\times 10^{13}$ Hz, $5.19\times 10^{13}$ Hz, and $5.13\times 10^{13}$ Hz respectively.