Example 1
Note that has no value in this example.
>
|
|
Solution:
In this case, defining corrects the error.
Example 2
This one is more subtle because the sum command is following Maple's normal evaluation rules. The index operation is attempted before sum is called. At this point, the name does not have a value.
>
|
|
>
|
|
Solution 1:
Evaluation of needs to be delayed using right single quotes.
>
|
|
Solution 2:
Instead of sum, use add. The add command is recommended for adding a finite sequence of values. The add command has special evaluation rules, so no error occurs in the evaluation.
>
|
|
Example 3
A nested call to sum with only one set of right single quotes leads to a different error. A second set of right single quotes corrects the problem.
>
|
|
>
|
|
>
|
|
Solution:
>
|
|