Error, bad index into Array - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

Home : Support : Online Help : Error, bad index into Array

Error, bad index into Matrix

Error, bad index into Array

Error, bad index into Vector

 

Description

Examples

Description

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.

Examples

Example 1

Note that  has no value in this example.

 

Error, bad index into Matrix

 

Solution:

In this case, defining corrects the error.

(2.1)

(2.2)

 

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.

 

Error, bad index into Vector

 

Solution 1:

Evaluation of needs to be delayed using right single quotes.   

(2.3)

 

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.

(2.4)

 

 

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.

 

(2.5)

Error, bad index into Matrix

Error, (in SumTools:-DefiniteSum:-ClosedForm) summand is singular in the interval of summation

 

Solution:

(2.6)

See Also

add

Matrices and Vectors

uneval

 


Download Help Document