Next: evaluator_destroy
, Previous: Main entry points, Up: Main entry points [Contents][Index]
evaluator_create
#include <matheval.h> void *evaluator_create (char *string);
Create evaluator object from string
containing mathematical
representation of function. Evaluator object could be used later to
evaluate function for specific variable values or to calculate
function derivative over some variable.
String representation of function is allowed to consist of decimal numbers, constants, variables, elementary functions, unary and binary operations.
Supported constants are (names that should be used are given in
parenthesis): e (e
), log2(e) (log2e
), log10(e)
(log10e
), ln(2) (ln2
), ln(10) (ln10
), pi
(pi
), pi / 2 (pi_2
), pi / 4 (pi_4
), 1 / pi
(1_pi
), 2 / pi (2_pi
), 2 / sqrt(pi) (2_sqrtpi
),
sqrt(2) (sqrt
) and sqrt(1 / 2) (sqrt1_2
).
Variable name is any combination of alphanumericals and _
characters beginning with a non-digit that is not elementary function
name.
Supported elementary functions are (names that should be used are given
in parenthesis): exponential (exp
), logarithmic (log
),
square root (sqrt
), sine (sin
), cosine (cos
),
tangent (tan
), cotangent (cot
), secant (sec
),
cosecant (csc
), inverse sine (asin
), inverse cosine
(acos
), inverse tangent (atan
), inverse cotangent
(acot
), inverse secant (asec
), inverse cosecant
(acsc
), hyperbolic sine (sinh
), cosine (cosh
),
hyperbolic tangent (tanh
), hyperbolic cotangent (coth
),
hyperbolic secant (sech
), hyperbolic cosecant (csch
),
hyperbolic inverse sine (asinh
), hyperbolic inverse cosine
(acosh
), hyperbolic inverse tangent (atanh
), hyperbolic
inverse cotangent (acoth
), hyperbolic inverse secant
(asech
), hyperbolic inverse cosecant (acsch
), absolute
value (abs
), Heaviside step function (step
) with value 1
defined for x = 0, Dirac delta function with infinity (delta
) and
not-a-number (nandelta
) values defined for x = 0, error
function (erf
), and min (min
) and max (max
) functions.
Supported unary operation is unary minus ('-'
).
Supported binary operations are addition ('+'
), subtraction
('+'
), multiplication ('*'
), division multiplication
('/'
) and exponentiation ('^'
).
Usual mathematical rules regarding operation precedence
apply. Parenthesis ('('
and ')'
) could be used to change
priority order.
Blanks and tab characters are allowed in string representing function; newline characters must not appear in this string.
Pointer to evaluator object if operation successful, null pointer otherwise. Evaluator object is opaque, one should only use return pointer to pass it to other functions from library.
Next: evaluator_destroy
, Previous: Main entry points, Up: Main entry points [Contents][Index]