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[cost] - operation evaluation count
Calling Sequence
cost(x1, x2,...,xn)
Parameters
xk
-
of type algebraic, name = algebraic, array(algebraic)
Description
The cost command is used to compute an operation count for the numerical evaluation of the given arguments. The operation count is expressed as a polynomial in the names additions, multiplications, assignments, divisions, functions, storage, subscripts, integrals, products and assignments with non-negative integer coefficients.
Assignment of positive real values to these global names yields a weighted cost.
Note that the cost used for computing powers is as follows. For an integral power, repeated multiplication is assumed. For a general power it is assumed to be computed using exp and ln.
The command with(codegen,cost) allows the use of the abbreviated form of this command.
Examples
Using numeric values to express the relative costs of various operations, you can derive a numerical measure of the cost of an expression or procedure. This can then be used to evaluate whether or not to use an optimized version.
See Also
codegen[optimize]
Download Help Document