> Otherwise, the result must be 11x11
Otherwise?? I guessed the result should be a 11 x 11 matrix in any case. Some matrix elements will be 0 and some calculated based upon your two formulas.
>|M.xy| is only the absolute value of M.xy.
Thats what I suspected. And I guess the same is true for |M.x| and |M.y|, too.
So the best solution in my opinion would be to turn the calculations into functions and write those functions as if only normal scalars are involved. The names of the formal arguments do not matter, as you can see in my solution for m.x_top().
And if this function does what it should for single scalar values, you may then call it vectorized (!!) with your matrices as arguments to get the matrix you are looking for.
See if the attached solution helps and provides the correct results you expect:

Regards
Werner
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
