Ed's Big Plans

Computing for Science and Awesome

Archive for the ‘Partial Derivatives’ tag

Partial Derivatives for Residuals of the Gaussian Function

without comments

I needed to get the partial derivatives for the residuals of the Gaussian Function this week. This is needed for a curve fit I’ll use later. I completely forgot about Maxima, which can do this automatically — so I did it by hand (Maxima is like Maple, but it’s free). I’ve included my work in this post for future reference. If you want a quick refresh on calculus or a step-by-step for this particular function, enjoy :D. The math below is rendered with MathJax.

The Gaussian Function is given by …

$$ f(x) = ae^{-\frac{(x-b)^2}{2c^2}} $$

  • a, b, c are the curve parameters with respect to which we differentiate the residual function
  • e is Euler’s number

Given a set of coordinates I’d like to fit (xi, yi), i ∈ [1, m], the residuals are given by …

$$ r_i = y_i – ae^{-\frac{(x_i-b)^2}{2c^2}} $$

We want to get …

$$ \frac{\partial{r}}{\partial{a}}, \frac{\partial{r}}{\partial{b}}, \frac{\partial{r}}{\partial{c}} $$

Read the rest of this entry »

Eddie Ma

October 10th, 2011 at 11:40 am