How to get a linsolve solution in matrix form?

m using SymPy in Julia. My purpose is to solve a homogeneous system of linear equations (Ax=0) with more unknowns than variables (A is not square). Then, Im using the following code.

using SymPy

x, y, z, w = symbols("x y z w")

M = sympy.Matrix(((9, 2, 1,- 4, 0), (-4, -3, -1, -5, 0)))

s = linsolve(M, (x, y, z, w))

With this code Im able to get the correct solution. However, I´dont known how to manipulate that solution. The final goal is to be able to get the solution in matrix form as lines representing (x and y) and column (z and w). (since x(z, w) and y(z,w)).

Thanks

linsolve returns a FiniteSet. The conversion doesn’t happen automatically here, but you can get julia objects through collect(convert(Set,s)).

1 Like

Hi there! The instruction collect(convert(Set,s)), at least for me, just display as a markdown expression the solution. However, how can I effectively manipulate this expression?