Can anyone explain this strange behaviour, both in R4 / R5 and Maple 6.
>with(linalg): >A:=diag(1,2,3)^n: > expand(A); n bb
The same result with Maple 7 and Maple 8. Corrected with Maple 9. (U. Klein)
> simplify(A); n b
This is corrected with Maple 7. (U. Klein)
I expected only the matrix A as output.
This is not the answer with which you are satisfied. This is my comments.
A command "expand" is a reverse of "factor". Therefore, I think that we should not apply "expand" to matrix, vector and so on.
A command "simplify" is a simplification rule for various types of expressions, which, I am afraid, do not include matrix, vector nor,....
Please try as followings;
>with(linalg): >A:=diag(1,2,3); >evalm(A^4);
I cannot explain where bb comes from, but if A is a matrix, in R4 / R5 the expressions
A^n, A*A or A+A
are syntax errors, which won’t do what you want. You have
to use multiply() and add(). In Maple 6 you can use the LinearAlgebra package
instead:
> with(LinearAlgebra): A:=DiagonalMatrix([1,2,3])^2: expand(A); [1 0 0] [ ] [0 4 0] [ ] [0 0 9]
but I am afraid you still get:
> with(LinearAlgebra): A:=DiagonalMatrix([1,2,3])^n: expand(A); [1 0 0]n [ ] [0 2 0] [ ] [0 0 3]
My impression is that linalg is only being maintained for the sake of compatibility between releases.
This is a bug!
Look at the following commads, which are independent on linalg or package LinearAlgebra of Maple 6:
> Z := array(1 .. 3, 1 .. 3,[(1, 1)=1,(3, 2)=0,(2, 1)=0,(2, 2)=2,(3, 3)=3, (1, 2)=0,(2, 3)=0,(1, 3)=0,(3, 1)=0])^m; > simplify(%); m b > expand(%%); m bb
The bug seems to be in procedure
`simplify/commonpow`
and `expand/power`
which have b and bb as local variables respectively. It seems that it is a problem of evaluation to name of these local variables.