(%i1) load(diag)$
(%i2) A:diag([a,b,c]);
(%o2) matrix([a,0,0],[0,b,0],[0,0,c])
(%i3) mat_function (exp, A);
(%o3) matrix([%e^a,0,0],[0,%e^b,0],[0,0,%e^c])
best
Aleksas D
When A is a diagonal matrix, exponentiation can be performed simply by exponentiating each of the diagonal elements.
With maxima 5.31.0, I get the following :
A: matrix ([a, 0, 0], [0, b, 0], [0, 0, c]);
%e^A; [ a ] [ %e 1 1 ] [ ] (%o2) [ b ] [ 1 %e 1 ] [ ] [ c ] [ 1 1 %e ]
which is clearly wrong (the "1" entries should be "0").
(%i1) load(diag)$
(%i2) A:diag([a,b,c]);
(%o2) matrix([a,0,0],[0,b,0],[0,0,c])
(%i3) mat_function (exp, A);
(%o3) matrix([%e^a,0,0],[0,%e^b,0],[0,0,%e^c])
best
Aleksas D
As shown by Aleksas, mat_function returns the correct result here. "^" is the scalar exponent so it's to be expected that it performs element-by-element exponentiation. However, I see now that "^^" also does it element-by-element -- that seems incorrect; I think %e^^A should perform the same operation as mat_function(exp, A). I'll make a separate report about that. Closing this report.
Log in to post a comment.