This repository contains numerical methods projects completed during my Master’s program. The projects involve scientific programming in Fortran and Python, focusing on:
🔹 Project 1: Interpolation / Extrapolation
• Potential of O₂
• Potential of the C₂H₅ radical
🔹 Project 2: Integration & Differentiation
• Average value
• Numerical derivatives of VO₂(R)
• Integration
🔹 Project 3: Model Fitting
• Spectroscopic Hamiltonian analysis
🧠 Developed using Fortran for high-performance numerical tasks and Python for data fitting and visualization.
We consider the internuclear potential of the O₂ molecule:
Where:
- D = 3.8886 eV
- R* = 2.2818 a₀
- α = 3.3522498 a₀⁻¹
- c₁ = 3.6445906 a₀⁻¹
- c₂ = 3.9281238 a₀⁻²
- c₃ = 2.0986689 a₀⁻³
This is a model adjusted to experimental spectroscopic data.
We want to interpolate the potential over the interval [1.8, 7]a₀ using these points:
- Lagrange Polynomial ( L(R) )
- Polynomial in powers of ( 1/R )
- Rational Polynomial (
RatInt.f
) - Cubic Splines (
Spline.f
)
Plot the interpolation error:
on a logarithmic scale for R in [1.8, 10], and compare the behavior of the interpolation and extrapolation methods.
We use the model potential:
This potential has the same symmetry properties as the exact one.
- Build an interpolation scheme V̄(φ) using
Minv.f
. - Determine the minimum number of interpolation points {φ_q} such that the standard deviation:
We want to compute the average distance of the electron to the nucleus in the hydrogen atom’s 3s orbital:
With:
- Gauss-Laguerre Quadrature (
Laguerre_Quad.c
) - Monte Carlo Method (with same RNG seed)
- (Optional) Monte Carlo with Importance Sampling
Compare with the analytical value:
Reuse the O₂ potential from Project I and compute its first and second derivatives at:
Study the effect of:
- Number of points used
- Spacing of points
Compare with the analytical derivatives.
Consider a laser pulse defined by the function:
Where:
- ω = 2
- T = 5π
- α = 0.05
- Compute the fluence Φ:
- Trapezoidal method
- Simpson's rule
Increase the number of integration points until the relative convergence reaches 10⁻⁸.
We consider the vibrational spectroscopic Hamiltonian:
Adjust the parameters T₀, {ωα}, {xαβ}, and {yαβγ} using the least squares method. These parameters can be determined based on the list {Eexp(n)} (see the file HFCO_exp.dat
), which contains the first 150 calculated vibrational levels of the HFCO molecule.
- Fit Only ωα and xαβ and use a regular matrix inversion method to perform the least squares fit:
numpy.linalg.inv
-
Include yαβγ terms. Some of these parameters cannot be determined. if the state (n₁ = 1, n₂ = 1, n₃ = 1, n₄ = n₅ = n₆ = 0) does not appear in the list, then y₁₂₃ cannot be fitted.
-
Test with Singular Value Decomposition:
numpy.linalg.svd
- The fitted parameters
- The residuals
$E_{\text{exp}}(n) - E_{\text{sp}}(n)$ for all levels
The package is licensed under the MIT License.