13 #include "msdevstudio/MSconfig.h"
24 #ifdef ITERATOR_MEMBER_DEFECT
37 Weibull::Weibull (
double prefactor,
double scale,
double shape )
41 m_parms[0] = prefactor;
46 void Weibull::initialize ()
49 m_parm_names.push_back (
"Prefactor" );
50 m_parm_names.push_back (
"Scale" );
51 m_parm_names.push_back (
"Shape" );
61 double Weibull::operator () (
double x )
const
63 return m_parms[0]*exp( -pow(x/m_parms[1],m_parms[2]) )*pow(x,m_parms[2] - 1.0);
73 max_x = (min_x + max_x)/2.;
78 double min_y = helper->
valueAt (min_x);
79 double max_y = helper->
valueAt (max_x);
80 if (min_y != 0 && max_y != 0) {
81 m_parms[1] = ( min_x - max_x ) / log( max_y/min_y );
82 m_parms[0] = max_y / exp( -max_x/m_parms[1] );
85 }
catch (std::string &message) {
86 std::cerr << message << std::endl;
94 double Weibull::derivByParm (
int i,
double x )
const
98 return operator()(x)/m_parms[0];
102 return operator()(x)*pow(x/m_parms[1],m_parms[2]) * m_parms[2]/m_parms[1];
106 return operator()(x)*(log(x) - pow(x/m_parms[1],m_parms[2]) * log(x/m_parms[1]));
FunctionHelper class interface.
std::vector< intptr_t > shape(numeric::array arr)
A function can be used with a fitter.
virtual double minCoord() const =0
Returns the smallest coordinate value along the X axis in the data set.
numeric::array clone(numeric::array arr)
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.