Download Maple Introductory Programming Guide

Transcript
vi
• Contents
The Selection Operation [] . . . . . . . . . . . . . . . .
The op Command . . . . . . . . . . . . . . . . . . . . .
The select, remove, and selectremove Commands . .
4.6 Converting Between Data Structures . . . . . . . . . . .
Converting a Sequence to a Set or a List . . . . . . . . .
Converting Other Data Structures . . . . . . . . . . . .
4.7 Other Maple Data Structures . . . . . . . . . . . . . . .
Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . .
Wrong Number of Parameters in Function . . . . . . . .
Invalid Subscript Selector . . . . . . . . . . . . . . . . .
Requires Range or Initialization List for Building arrays
Error in array Bound or Array Index out of Range . . .
4.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . .
4.10 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . .
5 Flow Control
In This Chapter . . . . . . . . . . . . . . . . . . . .
5.1 Selection and Conditional Execution . . . . . . . . .
The if Statement . . . . . . . . . . . . . . . . . . .
The ‘if‘ Operator . . . . . . . . . . . . . . . . . . .
5.2 Repetition . . . . . . . . . . . . . . . . . . . . . . . .
The for Loop . . . . . . . . . . . . . . . . . . . . . .
The while Loop . . . . . . . . . . . . . . . . . . . .
Control within Loops . . . . . . . . . . . . . . . . . .
5.3 Looping Commands . . . . . . . . . . . . . . . . . .
The map Command . . . . . . . . . . . . . . . . . . .
The select, remove, and selectremove Commands
The zip Command . . . . . . . . . . . . . . . . . . .
The seq, add, and mul Commands . . . . . . . . . .
Using Specialized Looping Commands . . . . . . . .
5.4 Troubleshooting . . . . . . . . . . . . . . . . . . . . .
Cannot Evaluate Boolean in if Statement . . . . . .
Value in Loop Must Be Numeric or Character . . . .
Variable Previously Assigned . . . . . . . . . . . . .
Wrong Parameters in Function $ . . . . . . . . . . .
5.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . .
5.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . .
6 Maple Procedures
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
152
155
156
158
158
159
159
159
161
162
163
163
164
164
165
166
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
167
167
167
167
171
172
173
177
178
180
180
181
182
183
185
187
188
188
189
190
191
191
193