I am trying to calculate the first order partial derivatives of the Gaussian function. My calculations look correct to me but when I implement them in a C program I do not get the desired result. So, I am trying to figure out if my maths are wrong or if my code is wrong.
Assume we have the following Gaussian function:
$$f(x)=ae^{-\tfrac{(x-b)^2}{2c^2}}+d$$
The first order partial derivatives of the Gaussian function with respect to each parameter according to my calculations are:
\begin{align} \frac{\partial f}{\partial a}&=e^{-\tfrac{(x-b)^2}{2c^2}}\\ \frac{\partial f}{\partial b}&=ae^{-\tfrac{(x-b)^2}{2c^2}}\frac{x-b}{c^2}\\ \frac{\partial f}{\partial c}&=ae^{-\tfrac{(x-b)^2}{2c^2}}\frac{(x-b)^2}{c^3}\\ \frac{\partial f}{\partial d}&=1 \end{align}
Can someone verify that my maths are correct? Thank you.
For inspections such as these, wolfram alpha is very useful. For example: This link shows that your first derivative is OK. Similarly for the others:
Derivative over $b$
Derivative over $c$
Derivative over $d$