Consider the following output by the linsolve function of sympy. solution_vector = (-2.0*x2 - 2.0, 4.0*x4 + 4.0*x7 + 2.0, x2, -2.0*x4 - 1.0*x5 - 2.0*x7 - 2.0, x4, x5, x6, x7, x8) As we can see, in this instance, x2,x4, x5, x6, x7, x8 are the free variables. I am wondering what is the cleanest way to perform substitution for the free variables in the solution vector. E.g) x2 = x4 = x5 = x6 = x7 = x8 = 0, giving us the solution vector (-2, 2, 0, -2, 0, 0, 0, 0, 0) The main hurdle is that the free variables changes, I try processing the vector to filter out the free variables, but the end result is a bit of a mess. Thus I was wondering if there is/are cleaner way(s) to perform this task. Continue reading...