14 double Amsterdam_Method(
double (*f)(
double),
double a,
double fa,
double c,
double fc,
15 double tol,
int max_iter,
int& err );
46 double p_x(
int ip)
const
50 double p_y(
int ip)
const
58 double p_numerator(
double dab,
double dcb,
double fa,
double fb,
double fc)
60 return fb*(dab*fc*(fc-fb)-fa*dcb*(fa-fb));
64 return (fc-fb)*(fa-fb)*(fa-fc);
108 int test = s1*
sign3(fx2);
114 p_history.push_back( pair<double,double>(x1,fx1) );
115 p_history.push_back( pair<double,double>(x2,fx2) );
116 p_a = ( x1 <
x2 ) ? 0 : 1;
117 p_c = ( x1 <
x2 ) ? 1 : 0;
120 void add(
double x,
double fx )
122 p_history.push_back( pair<double,double>(x,fx) );
132 double rel_step =
safe_div( next, last ) - 1.;
133 rel_step =
sign(
min(abs(rel_step),abs(max_rel_step)), rel_step );
134 return (1.+rel_step)*last;
138 double deriv(
int n,
double& sigma)
const;
146 return deriv( n, sigma );
155 double zero_fit(
int n,
double& sigma)
const;
189 for(
unsigned int i=0; i <
p_history.size(); ++i )
253 if( next_est < current )
double p_midpoint() const
double deriv(double &sigma) const
double bracket_width() const
void set_NaN(sys_float &x)
void add(double x, double fx)
void print_history() const
double p_denominator(double fa, double fb, double fc)
double deriv(int n) const
double zero_fit(int n) const
static const int PREV_ITER
double Amsterdam_Method(double(*f)(double), double a, double fa, double c, double fc, double tol, int max_iter, int &err)
T next_val(T current, T next_est)
realnum next_val(realnum current, realnum next_est)
vector< pair< double, double > > p_history
int init_bracket(double x1, double fx1, double x2, double fx2)
static const int PREV_ITER
int dprintf(FILE *fp, const char *format,...)
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
double zero_fit(double &sigma) const
void print_status() const
int fprintf(const Output &stream, const char *format,...)
int in_bounds(double x) const
void p_set_root(double x)
double p_numerator(double dab, double dcb, double fa, double fb, double fc)
double next_val(double max_rel_step)