Solving A*x=b in Nemo

The functions for solving or checking solvability are can_solve and can_solve_with_solution. Only works with matrices though, so your example would look like:

julia> A = QQ[1 0 0; 0 1 1; 0 3 0; 0 0 1]
[1   0   0]
[0   1   1]
[0   3   0]
[0   0   1]

julia> Q =  [2 ,-3 , 1, 1]
4-element Vector{Int64}:
  2
 -3
  1
  1

julia> B = matrix(QQ, 4, 1, Q)
[ 2]
[-3]
[ 1]
[ 1]

julia> can_solve(A, B)
false

See also the docstring of can_solve.

(Here is how it would look like to compute a solution in case one exists:

julia> B = matrix(QQ, 4, 1, [1, 0, 0, 0])
[1]
[0]
[0]
[0]

julia> can_solve_with_solution(A, B)
(true, [1; 0; 0])

)

3 Likes