On 23 Lut, 11:53, Frithjof Schulze <[email protected]>
wrote:
> Hi,
>
> in Maple I can do something like
>
> > A := Matrix([[1,2,3],[1,3,0],[1,4,3]]);
> > b := Vector([1,2,3]);
> > x := Linsolve(A,b) mod 6;
>
> to solve a system of linear equations modulo 6 but the obvious
> Sage code only works over integral domains:
>
> sage: A = matrix(Zmod(6), [[1,2,3],[1,3,0],[1,4,3]])
> sage: b = vector(Zmod(6), [1,2,3])
> sage: A.solve_right(b)
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> ...
> TypeError: base ring must be an integral domain
>
> Is this implemented somewhere in Sage (or Pari, Singular, ...)?
>
> Best,
> Frithjof



sage: gp('matsolvemod([1,2,3;1,3,0;1,4,3],6,[1,2,3]~,1)')
[[-1, 1, 0]~, [0, 3, -3; 0, -3, -3; 2, 1, 1]]

If flag = 1, all solutions are returned in the form of a two-component
row vector [x,u], where x is a small integer solution to the system of
congruences and u is a matrix whose columns give a basis of the
homogeneous system (so that all solutions can be obtained by adding x
to any linear combination of columns of u). If no solution exists,
returns zero.

Andrzej Chrzeszczyk

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to