<< toSciCode SYMSCI Toolbox toString >>

SYMSCI Toolbox >> SYMSCI Toolbox > toSciFunction

toSciFunction

convert symbolic expression to Scilab function

Calling Sequence

fun = toSciFunction( expr )

Arguments

expr

symbolic scalar expression

func

scilab function

Description

Converts a symbolic expression expr to a Scilab function func, which takes values for the free symbols of expr as input arguments.

Examples

// 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;

See Also

Authors

Bibliography

SymEngine: C++ library for fast symbolic manipulation.


Report an issue
<< toSciCode SYMSCI Toolbox toString >>