Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: Matrix product Modulus an integer

  1. Feb 26, 2010 #1
    I need to multiply 2 matrix in Mathematica but modulus an Integer.

    The "Modulus->n" option cannot be used with "Dot" function. You can use Modulus-> n with "Inverse" or even "Det" but not with "Dot". It is something strange.

    How should I do it, then? Any idea?
    Thank you.
     
  2. jcsd
  3. Feb 26, 2010 #2

    Dale

    Staff: Mentor

    Well, it is crude but you can do

    Inverse[Inverse[A,Modulus->n],Modulus->n]
     
  4. Feb 27, 2010 #3
    Sorry DaleSpam but I don't catch you. I need the product of A and B modulus->n.
     
  5. Feb 27, 2010 #4

    Dale

    Staff: Mentor

    Inverse[Inverse[A.B,Modulus->n],Modulus->n] would that work? If not then you can always use Inner which is a generalization of Dot where you are allowed to specify your multiplication operator.
     
  6. Feb 28, 2010 #5
    Thank you DaleSpam but it would not work. I will see how could I use Inner.
    Thanks a lot
     
  7. Mar 11, 2010 #6
    You can use this code:

    matrixa = {{4, 3}, {1, 2}};
    matrixb = {18, 11};
    modulo = 26;
    som = matrixa.matrixb
    Mod[som, modulo]
     
  8. Mar 11, 2010 #7
    I am sorry but (a.b Mod m) is not iqual to (a Mod m).(b Mod m) being a and b matrix

    thank you very much
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica: Matrix product Modulus an integer
Loading...