codegen
prep2trans
prepare a Maple procedure for translation
split
prepare a Maple procedure for automatic differentiation
horner
convert formulae in a procedure to horner form
Calling Sequence
Parameters
Description
Examples
prep2trans(f)
horner(f, x)
split(f)
split(f, x)
f
-
Maple procedure
x
list or set of symbols
The prep2trans function is used to transform certain symbolic expressions into forms suitable for translation into a target language such as C or Fortran. For example, piecewise expressions are translated into if statements, symbolic sums are translated into for loops.
The horner function takes as input a Maple procedure and a variable or list or set of variables, and converts all formulae in the procedure to Horner form in x.
The split function is used to break up certain symbolic expressions into computation sequences suitable for automatic differentiation. Long products and complicated compositions are broken up into computation sequences. If the second argument x is specified, it specifies the independent variables, the variables that the function f will be differentiated in.
The command with(codegen,prep2trans) allows the use of the abbreviated form of this command.
The command with(codegen,split) allows the use of the abbreviated form of this command.
The command with(codegen,horner) allows the use of the abbreviated form of this command.
f := proc(x) piecewise(x<0,0,x<1,x,x>1,2-x,0) end proc;
f := proc(x) local s; sum(x^i/i!,i=0..n) end proc;
f := proc(n,A) local i,j; sum(sum(A[i,j],i=1..n),j=1..n) end proc;
h := proc(x,y,z) 1-2*x*y-x*y^2*z*(1-x) end proc;
g := proc(x,y,t) 2*sin(x^2*y)*exp(-t^2) end proc;
See Also
codegen[C(deprecated)]
codegen[fortran(deprecated)]
codegen[GRADIENT]
codegen[optimize]
Download Help Document