Distributing trig functions over a matrix



-----maxima-bounces at math.utexas.edu wrote: -----


>The problem I have is for the i() function, the sin function does not
>distribute over each element of the matrix in the same way a function
>like exp() would. Instead the result I get would be something like...
>
>sin([1 2])*[8 9]
>    [3 4]  [7 6]
>
>Instead of...
>
>[sin(1)*8 sin(2)*9]
>[sin(3)*7 sin(4)*6]
>

Try 'matrixmap.' Here is an example:

(%i3) matrixmap('cos, matrix([a,b],[c,d]));
(%o3) matrix([cos(a),cos(b)],[cos(c),cos(d)])

To view the documentation for matrixmap, enter "? matrixmap"

Barton