Go to the documentation of this file.
33 #include <gsl/gsl_math.h>
35 #include <boost/numeric/ublas/vector.hpp>
37 #include <boost/multiprecision/cpp_dec_float.hpp>
40 #include <o2scl/shunting_yard.h>
41 #include <o2scl/err_hnd.h>
43 #ifndef DOXYGEN_NO_O2NS
48 typedef std::function<double(
double)>
funct;
51 typedef std::function<
long double(
long double)>
funct_ld;
53 #if defined(O2SCL_LD_TYPES) || defined(DOXYGEN)
60 typedef std::function<boost::multiprecision::cpp_dec_float_50
61 (boost::multiprecision::cpp_dec_float_50)>
108 O2SCL_ERR2(
"A parameter cannot have the same name as ",
109 "the variable in funct_string::set_parm().",
123 #ifndef DOXYGEN_INTERNAL
131 mutable std::map<std::string,double>
vars;
141 #ifndef DOXYGEN_NO_O2NS
210 O2SCL_ERR2(
"A parameter cannot have the same name as ",
211 "a variable in funct_string::set_parm().",
226 #ifndef DOXYGEN_INTERNAL
234 mutable std::map<std::string,double>
vars;
246 #ifndef DOXYGEN_NO_O2NS
259 #ifndef DOXYGEN_NO_O2NS
calculator calc
The object for evaluating strings.
int set_function(std::string expr, std::string var1, std::string var2)
Specify the string and the parameters.
funct2_string(std::string expr, std::string var1, std::string var2)
Specify the string and the parameters.
int set_function(std::string expr, std::string var)
Specify the string and the parameters.
std::string st_form
The expr.
#define O2SCL_ERR2(d, d2, n)
Set an error, two-string version.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
virtual double operator()(double x) const
Compute the function at point x and return the result.
std::string st_var1
The variable.
std::string st_var2
The variable.
std::function< boost::multiprecision::cpp_dec_float_50(boost::multiprecision::cpp_dec_float_50)> funct_cdf50
One-dimensional function typedef in src/base/funct.h.
std::string st_form
The expr.
void compile(const char *expr, std::map< std::string, double > *vars=0, bool debug=false, std::map< std::string, int > opPrec=opPrecedence)
Compile expression expr using variables specified in vars and return an integer to indicate success o...
static double funct_wrap(double x, void *params)
The function wrapper.
@ exc_einval
invalid argument supplied by user
Evaluate a mathematical expression in a string.
std::map< std::string, double > vars
Parameter map.
std::function< long double(long double)> funct_ld
One-dimensional function typedef in src/base/funct.h.
virtual double operator()(double x, double y) const
Compute the function at point x and return the result.
A wrapper to specify o2scl::funct objects to GSL.
int set_parm(std::string name, double val)
Set the values of the auxilliary parameters that were specified in parms in the constructor.
One-dimensional function from a string.
funct_gsl(funct &f)
Create an object based on the specified function, f.
int set_parm(std::string name, double val)
Set the values of the auxilliary parameters that were specified in parms in the constructor.
funct_string(std::string expr, std::string var)
Specify the string and the parameters.
std::map< std::string, double > vars
Parameter map.
std::string st_var
The variable.
std::function< double(double)> funct
One-dimensional function typedef in src/base/funct.h.
double eval(std::map< std::string, double > *vars=0)
Evalate the previously compiled expression using variables specified in vars.
calculator calc
The object for evaluating strings.
Two-dimensional function from a string.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).