33 #include <gsl/gsl_math.h>
35 #include <boost/numeric/ublas/vector.hpp>
37 #include <o2scl/fparser.h>
39 #ifndef DOXYGEN_NO_O2NS
44 typedef std::function<double(double)>
funct11;
69 int np=0, std::string parms=
"") {
71 fpw.Parse(formula,var);
75 std::string all=var+
","+parms;
76 fpw.Parse(formula,all);
92 int np=0, std::string parms=
"") {
94 fpw.Parse(formula,var);
98 std::string all=var+
","+parms;
99 fpw.Parse(formula,all);
113 for(
int i=0;i<
st_np;i++) {
126 double *all=
new double[
st_np+1];
128 for(
size_t i=1;i<=
st_np;i++) all[i]=
arr[i-1];
135 #ifndef DOXYGEN_INTERNAL
158 #ifndef DOXYGEN_NO_O2NS
193 #ifndef DOXYGEN_NO_O2NS
Parse a mathematical function specified in a string.
std::function< double(double)> funct11
One-dimensional function typedef.
static double funct_wrap(double x, void *params)
The function wrapper.
int set_function(std::string formula, std::string var, int np=0, std::string parms="")
Specify the string and the parameters.
size_t st_np
The number of parameters.
int set_parms(const vec_t &p)
Set the values of the auxilliary parameters that were specified in parms in the constructor.
A wrapper to specify o2scl::funct11 objects to GSL.
std::string st_var
The variables.
std::string st_form
The formula.
funct_gsl(funct11 &f)
Create an object based on the specified function, f.
std::string st_parms
The parameters.
virtual double operator()(double x) const
Compute the function at point x and return the result.
FunctionParser fpw
The object for evaluating strings.
ubvector arr
Storage for the fpw call.
One-dimensional function from a string.
funct11_string(std::string formula, std::string var, int np=0, std::string parms="")
Specify the string and the parameters.