suggestion---
perhaps
start the manual with a specific example that
has a more meaningful example without
1-to-1 mapping
(of just x)
.
it took me a while to realize what libmatheval does.
for example,
char *algebraic_expression=
"sqrt(2*x+3*y)"
;
const
int count=2;
char *names
[count+1]
= { "x", "y", NULL };
double
v[count+1] = { 4.0, 5.0, NULL };
f = evaluator_create(
algebraic_expression
);
assert(f);
evaluator_get_variables (f, &names, &count);
for (int i = 0; i < count; i++) printf ("%s
=%g
", names[i]
, v[i]
);
printf("
==> %s
=
>
%g\n",
algebraic_expression,
evaluator_evaluate (f,
count
, names,
values));
evaluator_destroy (f);
this may not work---I did not install libmatheval, but just wanted to
share how it reads to a novice. I need a tool that is broader:
is there a version of libmatheval that adds variables and functions?
char *algebraic_expression=
"
x=4; y=5; f=f(x1,x2)
sqrt(2*x
1
+3*
x2
)
; f(x,y)
"
;
I could embed lua, but a library like libmatheval that was more algebra
focused and lightweight would be preferable.
regards,
iaw
----
Ivo Welch ([email protected])
http://www.ivo-welch.info/