I'm trying to figure out how to use Mathematica from C via Mathlink.
If I just want to compute the value of a built-in function, I can do
MLPutFunction( lp, "RiemannSiegelZ", 1L);
MLPutDouble(lp, val);
and all is fine.
Now, if I want the value of the derivative, things get worse:
MLPutFunction( lp, "RiemannSiegelZ'", 1L);
MLPutDouble(lp, val);
does not work. I tried to insert the "D" function, but I couldn't seem to get it working. The best way I could find this far is this
char query[128];
sprintf(query, "N[RiemannSiegelZ'[%.20lf]]", val);
MLPutFunction(lp, "ToExpression", 1);
MLPutString(lp, query);
it does work, but it's extremely slow, probably because I'm asking Mathematica to parse the expression, instead of just calling the function ... Is there a better way?