I have a system of 52 equations with float coefficients (usually not rationals). This long list of equations is stored in variable concrete_eqs
, and the list of unknowns (Lagrangians) in lagran
. The system is linear.
Using solve
, the solution would be:
result = solve(
concrete_focs, lagran
,simplify = False
,exclude = []
)
Using linsolve
, it would be:
linresult = list(linsolve(concrete_focs, lagran))
I checked the solution using solve
by substituting back into the equations and it gives the correct result. Using linsolve
, not only are the solutions different, but they are wrong: they do not solve the system when I substitute them back.
linsolve
does not throw any errors. I transformed the system of equations into matrix form by using linear_eq_to_matrix
, and the system has full rank. Since the unknowns are indexed variables, I also tried to solve the system with linsolve
and only symbols, but this didn't solve the issue.
I would like to solve this linear system with linsolve
, since it is much faster than solve
, even for this simple system.
I tried to reproduce the issue in simpler problems, using indexed variables, but I got the correct result.
Any hints on why this may be happening? (I suspect it is because of the handling of the float irrational coefficients, but I'm not sure.)