I have been trying to implement the IGRF-13 geomagnetic model on my own in C code. I have followed the equations from the website below and I am getting correct results for the B$_{\phi}$ and Br magnetic field strength components.
But right now I am completely stuck on the B$_{\theta}$ component which requires calculating the Partial derivatives of the Schmidt Normalized Associated Legendre Polynomials with respect to theta according to equation 3b.
Now, how do I do that? The recursive equations 19 a, b, and c are not producing the correct results, and there is no information on the internet about this.
I would really appreciate it if someone could provide a sample code that calculates the "Partial derivatives of the Associated Legendre Polynomials" or maybe provide the equations that will allow me to calculate them.
Reference: Mathematical Modeling of Earth’s Magnetic Field (PDF)