convert symbolic expression to Scilab function
fun = toSciFunction( expr )
symbolic scalar expression
scilab function
Converts a symbolic expression expr to a Scilab function func, which takes values for the free symbols of expr as input arguments.
// symbols Syms f g x // symbolic expression f ... f : "(x+sin(3*x)*exp(-x))^2" // ... and its derivative g : Diff(f,x) // convert them to Scilab functions ff = toSciFunction(f) gg = toSciFunction(g) // call them, e.g. for x=2 ... ff(2) gg(2) // or use them for other purposes, e.g. plotting t = 0:0.05:4; plot(t, feval(t,ff), t, feval(t,gg)); legend(["f","g = df/dx"],2); // clean up reset(); clear f g x ff gg; | ![]() | ![]() |
SymEngine: C++ library for fast symbolic manipulation.