Download Maple Introductory Programming Guide

Transcript
8.1 A Tutorial Example
• 293
If you do not look carefully, this also looks correct. Assume that nothing is wrong and continue execution.
DBG > cont
count := 2*l
sieve:
5
if flags[i] then
...
end if
This output is suspicious because Maple should have simplified 2*1.
Notice that it has printed 2*l (two times the letter l) instead. By studying
the source text for the procedure, you can see that the letter “l” was
entered instead of the number “1”. Since the source of the error has been
discovered, there is no reason to continue the execution of the procedure.
Use the quit debugger command to exit the debugger, and then use the
unstopwhen command to remove the watchpoint from the procedure.
DBG > quit
Warning, computation interrupted
> unstopwhen();
[]
After correcting the source text for sieve, issue a restart command,
read the corrected version of sieve into Maple, and execute the procedure
again.
> sieve(10);
9