Example 1
In this first example, M and V appear to be of the same type, but they are not:
When addition is attempted an error occurs.
Solution:
To solve this error, use convert on one (or both) of the elements to be added. Here, we convert V to a Matrix before adding it to M:
>
|
|
Example 2
Here we try adding two column Vectors.
The error occurs because Y is a 3-element column Vector and Z is a 2-element column Vector.
Solution:
To correct this error, use the Vector constructor to create a 3-element Vector using Z as the initializer for the first two elements. If the new Vector has more elements than the initializer, the remaining elements are set to zero.
Example 3
Here we try adding two Arrays with different dimension.
>
|
|
>
|
|
Solution:
Again, the solution is to use Array to construct a 3X3 Array using B as the initializer.
>
|
|
>
|
|
For users of Maple 18 and earlier versions: These examples resulted in a different error message. The solutions are the same. For example, the example 3 given above resulted in: