Mathematica: Matrix product Modulus an integer

In summary, The conversation is about multiplying matrices in Mathematica while also applying the modulus of an integer. The speakers discuss the limitations of using the "Modulus->n" option with the "Dot" function and suggest alternative methods such as using the "Inverse" or "Det" functions. One speaker also mentions the use of the "Inner" function as a generalization of "Dot". The conversation ends with a code example for multiplying matrices and applying a modulus. The final speaker clarifies that the order of operations matters when applying the modulus and provides an example.
  • #1
zplot
17
0
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.
 
Physics news on Phys.org
  • #2
Well, it is crude but you can do

Inverse[Inverse[A,Modulus->n],Modulus->n]
 
  • #3
Sorry DaleSpam but I don't catch you. I need the product of A and B modulus->n.
 
  • #4
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.
 
  • #5
Thank you DaleSpam but it would not work. I will see how could I use Inner.
Thanks a lot
 
  • #6
You can use this code:

matrixa = {{4, 3}, {1, 2}};
matrixb = {18, 11};
modulo = 26;
som = matrixa.matrixb
Mod[som, modulo]
 
  • #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
 

1. What is Mathematica?

Mathematica is a powerful software program used for mathematical and scientific computations. It is commonly used by scientists, engineers, and mathematicians to solve complex problems, visualize data, and perform data analysis.

2. What is a matrix product in Mathematica?

A matrix product in Mathematica is the result of multiplying two or more matrices together. This is done using the "Dot" function, which takes two matrices as arguments and returns their product.

3. How do I find the modulus of a matrix product in Mathematica?

To find the modulus of a matrix product in Mathematica, you can use the "Mod" function. This function takes two arguments - the matrix product and the integer modulus - and returns the remainder after dividing the product by the modulus.

4. Can I use non-integer values for the modulus in Mathematica?

Yes, the "Mod" function in Mathematica can take non-integer values as the modulus. However, the result will always be an integer, as the function calculates the remainder after dividing by the modulus.

5. How can I perform a matrix product modulus an integer in Mathematica?

To perform a matrix product modulus an integer in Mathematica, you can use the "Mod" function in combination with the "Dot" function. First, calculate the matrix product using "Dot", then use the "Mod" function to find the remainder after dividing the product by the desired modulus.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
406
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
256
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top