makeproc - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


codegen

  

makeproc

  

make a Maple procedure from formulae

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

makeproc(a, x)

makeproc(a, x, ...)

Parameters

a

-

formula, list, array of formulae, or Array of formulae

x

-

symbol or a list of symbols

Description

• 

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.

Examples

> 

with⁡codegen,makeproc:

> 

f≔x⁢exp⁡−t−y⁢x⁢exp⁡−t

f≔x⁢ⅇ−t−y⁢x⁢ⅇ−t

(1)
> 

makeproc(f,[x,y,t]);

procx,y,tx*exp⁡−t − y*x*exp⁡−tend proc

(2)
> 

makeproc(f,[x,y]);

procx,yx*exp⁡−t − y*x*exp⁡−tend proc

(3)
> 

a≔series⁡11−x2,x,10

a≔1+x2+x4+x6+x8+O⁡x10

(4)
> 

makeproc(a,x::numeric);

procx::numeric1+1+1+x^2+1*x^2*x^2*x^2end proc

(5)
> 

A≔array⁡3⁢x,x3,x⁢y2,−x2⁢y

A≔3⁢xx3x⁢y2−x2⁢y

(6)
> 

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

(7)
> 

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

(8)
> 

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

(9)
> 

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

(10)

See Also

codegen[joinprocs]

codegen[optimize]