codegen - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : codegen Package : codegen/makeproc

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

withcodegen,makeproc:

fxⅇtyxⅇt

f:=xⅇtyxⅇt

(1)

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

procx,y,tx*exp−ty*x*exp−tend proc

(2)

makeproc(f,[x,y]);

procx,yx*exp−ty*x*exp−tend proc

(3)

aseries11x2,x,10

a:=1+x2+x4+x6+x8+Ox10

(4)

makeproc(a,x::numeric);

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

(5)

Aarray3x,x3,xy2,x2y

A:=3xx3xy2x2y

(6)

makeproc(A,[x,y]);

procx,ylocalA;A:=array1..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::array1..4A[1]:=3*x;A[2]:=x^3;A[3]:=x*y^2;A[4]:=−x^2*y;returnend proc

(8)

CSs=sinx,c=cosx,Ysxcxs2x+c2x:

makeproc(CS,x);

procxlocalc,s;s:=sinx;c:=cosx;c^2*xs^2*xc*xs*x+Yend proc

(9)

makeproc(CS,parameters=[x::numeric],locals=[s,c],globals=[Y]);

procx::numericlocals,c;globalY;s:=sinx;c:=cosx;c^2*xs^2*xc*xs*x+Yend proc

(10)

See Also

codegen[joinprocs]

codegen[optimize]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam