0
$\begingroup$

For instance, I want that Dot would be used as default multiplication of matrices instead of element-by-element multiplication. Similarly, I want any function (such as Sin [M]) when acting on a matrix, would return the same as MatrixFunction [Sin,M] instead of acting on the elements separately. Is it possible?

Maybe there is such global option?

$\endgroup$
2
  • 3
    $\begingroup$ Independent of whether this is possible, it would be a very bad idea to enforce that. Better not waste your time for trying to beat the system. $\endgroup$ – Henrik Schumacher Mar 11 at 14:32
  • 1
    $\begingroup$ I think it might be useful (for yourself, and for others coming to this QA) if you can identify exactly why it is that you would want to do something of this nature. If it is to save a number of keystrokes, this is one thing and may not make it worth your efforts, but if it is for another reason that seemingly carries enough worth, that is another story entirely. $\endgroup$ – CA Trevillian Mar 11 at 17:01
2
$\begingroup$

In some cases, you can do the kind of thing you want with UpValues, essentially defining your own matrix type. But not exactly what you want, since Times is Orderless, and matrix multiplication doesn't commute. This is an example of the rigor that a mindless CAS needs. Humans can use ambiguous notation, but computer notation must clearly distinguish between commutative and non-commutative multiplication.

$\endgroup$
4
  • 2
    $\begingroup$ Also, functions such as Sin are Listable. Messing with this would do massive damage. $\endgroup$ – Bob Hanlon Mar 11 at 14:54
  • $\begingroup$ @BobHanlon You wouldn't have to mess with the Listable attribute, as you would be making your matrices something that doesn't have List as its head. The Orderless attribute of Times is much more problematic. $\endgroup$ – mmeent Mar 11 at 14:59
  • $\begingroup$ @BobHanlon You could defeat Listable by wrapping your matrix. Not Orderless, though. $\endgroup$ – John Doty Mar 11 at 15:25
  • $\begingroup$ Guys, pretend the matrix types I use is commutative. So, this can be done? $\endgroup$ – Anixx Mar 11 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.