I want to double check that for M and N kxk mtrices and v a k-vector
M%^%2%*%N%*%v is not automatically read as (M%^%2)%*%N%*%v or
M%*%N%^%2%*%v is not automatically read as M%*%(N%^%2)%*%v or
both
I had been assuming the usual precedence (powers first, then multiplication) applies for matrix powers and multiplication in expm. I was getting unexpected results. In desperation I tried putting in the parentheses and seem to be getting much more reasonable answers. But I am so surprised that the matrix power operation is, apparently, not automatically given precedence over the matrix multiplication operation that I do not trust that adding parentheses has cured my bug. Maybe I am still making some other mistake instead. Can anyone confirm that in fact the parentheses are (sometimes?) essential? I could not find any documentation, one way or the other, just definitions of the power operator and of matrix exponentials.
TIA Rainer K. Sachs, Prof emertitus of math
M%^%2%*%N%*%v is not automatically read as (M%^%2)%*%N%*%v or
M%*%N%^%2%*%v is not automatically read as M%*%(N%^%2)%*%v or
both
I had been assuming the usual precedence (powers first, then multiplication) applies for matrix powers and multiplication in expm. I was getting unexpected results. In desperation I tried putting in the parentheses and seem to be getting much more reasonable answers. But I am so surprised that the matrix power operation is, apparently, not automatically given precedence over the matrix multiplication operation that I do not trust that adding parentheses has cured my bug. Maybe I am still making some other mistake instead. Can anyone confirm that in fact the parentheses are (sometimes?) essential? I could not find any documentation, one way or the other, just definitions of the power operator and of matrix exponentials.
TIA Rainer K. Sachs, Prof emertitus of math