Question: How to find all the free variables from LinearAlgebra:-LinearSolve result?

This is the context: I call LinearAlgebra:-LinearSolve to solve system of linear equations. If there are infinite solutions, then Maple return the solution that has free variables, calling them using  _t[n] where can change each time and be different. It can also be _t0[n] and _t1[n] etc.. but these all are indexed variables.

I want to obtain a list of all these free variables in the resulting solution vector, so that later I can assign them some values.

But I do not know what can be. And how many of them there are. There could be _t[3] and _t[4] for example in the same solution vector.

Here is what I do now, where I just check for indexed type. This seems to work, since only _t[n] should be in the resulting solution if any.

restart;
A:=Matrix([[0,1,-1],[-1,-2,2],[-1,-2,2]]):
v:=Vector([-1,1,1]):
sol := LinearAlgebra:-LinearSolve(A,v);

map(x->select(type,x,'indexed'),convert(sol,set))

I do not know how to tell it to look for all something that starts with  _t and also indexed type.

Is there a better way to obtain list of all _t[n] that LinearAlgebra:-LinearSolve could return? Will LinearAlgebra always return the free variables as indexed variables so I am sure the above will always work?  Do you see a problem with the above solution?

Please Wait...