Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
codegen[prep2trans] - prepare a Maple procedure for translation
codegen[split] - prepare a Maple procedure for automatic differentiation
codegen[horner] - convert formulae in a procedure to horner form
Calling Sequence
prep2trans(f)
horner(f, x)
split(f)
split(f, x)
Parameters
f
-
Maple procedure
x
list or set of symbols
Description
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.
Examples
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