Celeb Glow
general | April 09, 2026

Calculating the first order partial derivatives of the Gaussian function

$\begingroup$

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.

$\endgroup$ 4

1 Answer

$\begingroup$

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$

$\endgroup$ 2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy