Jump to content




[Math] Matrices


  • You cannot reply to this topic
5 replies to this topic

#1 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 09 September 2014 - 04:17 AM

So, I'm making a matrix function, complete with special metatables. The stuff I have so far works great, but I want to know, is there any way to divide a matrix? I have addition, subtraction, and multiplication, but I have no idea if this can be done, or how I should do it. If you can point me to a resource that explains this, I would be very greatful. If it doesn't exist, oh well... I guess I can just trigger an error. I already have matrix / number, I was just wondering about matrix / matrix.

I've posted this! http://www.computerc...-10-matrix-api/

Highly confidential code
Spoiler

Edited by KingofGamesYami, 10 September 2014 - 06:46 PM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 September 2014 - 04:22 AM

You may be interested in the wikipedia article on matrices, specifically the linked subsection on matrix operations.

#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 09 September 2014 - 05:11 AM

View PostLyqyd, on 09 September 2014 - 04:22 AM, said:

You may be interested in the wikipedia article on matrices, specifically the linked subsection on matrix operations.
Well, I can't find anything on division, so I guess it isn't possible? I've added some of the stuff in as functions though, thanks for the information.

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 09 September 2014 - 05:35 AM

It's not practical to divide a matrix, at least, not with another matrix. I mean, you can do it, but there are multiple (perhaps unlimited) possibilities as to the answer.

#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 September 2014 - 05:43 AM

I'm not a mathematician, as I may be about to make obvious, but if one were to perform a multiplication by an inverted matrix instead, would that be reasonable to describe as matrix division? I suspect not, but am not familiar enough with matrix operations myself to say either way.

Anyway, matrix division (if even a meaningful term) is obviously not something that occurs commonly enough (if at all) to be worthy of inclusion in an API.

#6 hilburn

  • Members
  • 153 posts
  • LocationLondon, England

Posted 10 September 2014 - 04:21 PM

Matrices don't really have a direct equivalence to Division other than What Lyqyd suggested. However you have to remember the non-commutability of matrices. This means that unlike numbers where a*b=b*a, [A]*[B]!=[B]*[A]

So: on to division. The simple way to think about it is that any matrix can be represented as the product of 2 other matrices (even if one of those matrices is the index)

So [C]=[A]*[B] where [B] is defined as the matrix we want to "divide" by. We achieve this by post-multiplying (remember order is important) by the inverse of [B], [B]^(-1) to get

[C]*[B]^(-1) = [A]*[B]*[B]^(-1) = [A]

Where [A] is the matrix that when multiplied by [B], gives [C]. Which is pretty close, but not exactly, what the result of a division is.

Edited by hilburn, 10 September 2014 - 04:21 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users