Error, bad index into Matrix
Error, bad index into Array
Error, bad index into Vector
Indexing into a Matrix, Array, or Vector must be done with integer values. Related to this, multi-element selection with a Matrix, Array, or Vector must also come down to integers at the endpoints. Trying to index a Matrix with a symbol will result in an error.
Note that n has no value in this example.
A ≔ 1,2 ; 3, 4
In this case, defining n corrects the error.
This one is more subtle because the sum command is following Maple's normal evaluation rules. The index operation Vi is attempted before sum is called. At this point, the name i does not have a value.
V ≔ 1,2, 3,4
Evaluation of Vi needs to be delayed using right single quotes.
sum 'Vi', i=1..4
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.
add Vi, i=1..4
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.
A ≔ Matrix3,i,j→i+j
Error, (in tools/add) bad index into Matrix
sumsum' 'A' 'i,j,i=1..3,j=1..3;
add, Matrices and Vectors, uneval
Download Help Document
What kind of issue would you like to report? (Optional)