13 #include "msdevstudio/MSconfig.h"
23 #ifdef ITERATOR_MEMBER_DEFECT
32 PowerLaw::PowerLaw ( )
37 PowerLaw::PowerLaw (
double prefactor,
double index )
41 m_parms[0] = prefactor;
45 void PowerLaw::initialize ()
48 m_parm_names.push_back (
"Prefactor" );
49 m_parm_names.push_back (
"Index" );
59 double PowerLaw::operator () (
double x )
const
61 return m_parms[0]*pow(x, m_parms[1]);
71 max_x = (min_x + max_x)/2.;
77 if (min_y != 0 && max_y != 0) {
78 m_parms[1] = log( max_y/min_y ) / log( max_x/min_x );
79 m_parms[0] = max_y/pow(max_x, m_parms[1]);
89 m_parms[1] = log( max_y/min_y ) / log( max_x/min_x );
90 m_parms[0] = max_y/pow(max_x, m_parms[1]);
93 double PowerLaw::derivByParm (
int i,
double x )
const
97 return pow(x, m_parms[1]);
101 return m_parms[0]*pow(x, m_parms[1])*log(x);
A function can be used with a fitter.
FunctionHelper class interface.
virtual double minValue() const =0
Returns the smallest value in the data set.
virtual double minCoord() const =0
Returns the smallest coordinate value along the X axis in the data set.
numeric::array clone(numeric::array arr)
virtual double maxValue() const =0
Returns the largest value in the data set.
PowerLaw class interface.
A function that can be added to a DataRep and used in a fitter.
An abstract base class to help FunctionBase objects perform some operations.
virtual double maxCoord() const =0
Returns the largest coordinate value along the X axis in the data set.
virtual double valueAt(double x) const =0
Returns the value at a given coordinate.