Skip to content

Commit

Permalink
Analytical Derivatives used re #4584
Browse files Browse the repository at this point in the history
The analytical derivatives are based on those in ExpDecayOsc as corrected in #4582

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Jan 23, 2012
1 parent 10c2414 commit 4426f41
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Code/Mantid/Framework/CurveFitting/src/ExpDecayMuon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ void ExpDecayMuon::functionMW(double* out, const double* xValues, const size_t n

void ExpDecayMuon::functionDerivMW(Jacobian* out, const double* xValues, const size_t nData)
{
// Use numerical derivates, because attempt to use analytic derivatives failed
calNumericalDeriv(out, xValues, nData);
const double& gA0 = getParameter("A");
const double& gs = getParameter("Lambda");

for (size_t i = 0; i < nData; i++) {
double x = xValues[i];
double e = exp( -gs*x );
out->set(i,0, e); //derivative w.r.t. A (gA0)
out->set(i,1, -gA0*x*e); //derivative w.r.t Lambda (gs)
}
}


Expand Down

0 comments on commit 4426f41

Please sign in to comment.