Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Solve rational linear system modulo the integers
ResourceFunction["LinearSolveModIntegers"][mat,rhs] solves the rational linear system mat.x=rhs modulo the integers for the unknown vector x. | |
ResourceFunction["LinearSolveModIntegers"][mat,rhs,True] solves the linear system modulo the integers and returns a list containing the solution vector and a set of rational vectors that span the null space. |
Find rational solutions modulo the integers to an overdetermined system:
In[1]:= |
Out[3]= |
Check that the result is correct modulo the integers:
In[4]:= |
Out[4]= |
Find a solution and generating set for the null vectors of an overdetermined system:
In[5]:= |
Out[6]= |
Use the null vector to obtain the other solution mod ℤ:
In[7]:= |
Out[7]= |
Check this:
In[8]:= |
Out[8]= |
Create a linear system over the rationals with a known solution:
In[9]:= |
Out[10]= |
Recover the solution from the matrix and right hand side:
In[11]:= |
Out[11]= |
Note that the found solution agrees with the known one modulo ℤ:
In[12]:= |
Out[12]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License