Ask Your Question

Linear Equations with infinite solutions

asked 2015-11-24 07:54:29 -0600

I have 4 equations with 6 variables, which means I will have 2 free variables, which means I would have infinitely many solutions. I found one solution but I don't know what functions I should use in Sage to generate 10 different solutions (as that is what I was asked to do).

This is what I did: M=matrix(QQ, [[1,2,3,4,5,6],[1,1,1,1,1,1],[1,-1,1,-1,1,-1],[1,2,1,3,1,4]]); x=vector(QQ, [6,1,-1,4]); M.solve_right(x)

It only gives me one solution: 0, -1, 0, 2, 0, 0, how do I get more?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-24 08:54:05 -0600

This is elementary linear algebra: the other solutions are obtained by adding vectors in the kernel... In Sage

M = matrix(QQ, [[1,2,3,4,5,6],[1,1,1,1,1,1],[1,-1,1,-1,1,-1],[1,2,1,3,1,4]])
x = vector(QQ, [6,1,-1,4])
v0 = M.solve_right(x)
K = M.right_kernel()
v1, v2 = K.basis()

From which you can build all solutions

sage: M * (v0 + 3*v1 - 19*v2) == x
sage: M * (v0 + 12*v1) == x
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2015-11-24 07:54:29 -0600

Seen: 176 times

Last updated: Nov 24 '15