REDUCE

15.3 Matrix-valued Procedures

Normally, procedures can only return scalar values. In order for a procedure to return a matrix, it has to be declared of type MATRIXPROC:

        matrixproc SkewSym1 (w);  
           mat((0,-w(3,1),w(2,1)),  
               (w(3,1),0,-w(1,1)),  
               (-w(2,1), w(1,1), 0));

Following this declaration, the call to SkewSym1 can be used as a matrix, e.g.

        X := SkewSym1(mat((qx),(qy),(qz)));  
 
 
             [  0     - qz   qy  ]  
             [                   ]  
        x := [ qz      0     - qx]  
             [                   ]  
             [ - qy   qx      0  ]  
 
        X * mat((rx),(ry),(rz));  
 
 
        [ qy*rz - qz*ry  ]  
        [                ]  
        [ - qx*rz + qz*rx]  
        [                ]  
        [ qx*ry - qy*rx  ]