Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
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