codegen
makeproc
make a Maple procedure from formulae
Calling Sequence
Parameters
Description
Examples
makeproc(a, x)
makeproc(a, x, ...)
a
-
formula, list, array of formulae, or Array of formulae
x
symbol or a list of symbols
The first argument a is a Maple formula, or a list of equations (which is understood to be a sequence of assignments), a named array of formulae, or an Array of formulae. The second argument x is a symbol or a list of symbols. The makeproc command returns a Maple procedure which evaluates a(x). The symbols in x may include types.
The optional arguments parameters=P, locals=L, and globals=G specify whether symbols are to be parameters, local variables, or global variables respectively. P, L, G must be lists of symbols, or symbols with types.
with⁡codegen,makeproc:
f≔x⁢exp⁡−t−y⁢x⁢exp⁡−t
f≔x⁢ⅇ−t−y⁢x⁢ⅇ−t
makeproc(f,[x,y,t]);
procx,y,tx*exp⁡−t − y*x*exp⁡−tend proc
makeproc(f,[x,y]);
procx,yx*exp⁡−t − y*x*exp⁡−tend proc
a≔series⁡11−x2,x,10
a≔1+x2+x4+x6+x8+O⁡x10
makeproc(a,x::numeric);
procx::numeric1+1+1+x^2+1*x^2*x^2*x^2end proc
A≔array⁡3⁢x,x3,x⁢y2,−x2⁢y
A≔3⁢xx3x⁢y2−x2⁢y
makeproc(A,[x,y]);
procx,ylocalA;A ≔ array⁡1..4;A[1] ≔ 3*x;A[2] ≔ x^3;A[3] ≔ x*y^2;A[4] ≔ −x^2*y;Aend proc
makeproc(A,[x,y,A]);
procx,y,A::array⁡1..4A[1] ≔ 3*x;A[2] ≔ x^3;A[3] ≔ x*y^2;A[4] ≔ −x^2*y;returnend proc
CS≔s=sin⁡x,c=cos⁡x,Y−s⁢x−c⁢x−s2⁢x+c2⁢x:
makeproc(CS,x);
procxlocalc,s;s ≔ sin⁡x;c ≔ cos⁡x;c^2*x − s^2*x − c*x − s*x+Yend proc
makeproc(CS,parameters=[x::numeric],locals=[s,c],globals=[Y]);
procx::numericlocals,c;globalY;s ≔ sin⁡x;c ≔ cos⁡x;c^2*x − s^2*x − c*x − s*x+Yend proc
See Also
codegen[joinprocs]
codegen[optimize]
Download Help Document