Error solving Matrix equation with numpy
Your issue is in your second for
loop.
for fnc in fncList: res2 = fnc for i in range(len(varz)): res2 = res2.subs(varz[i], x0[i]) fx0.append(res2)
When you append to fx0
, you need to ensure that you are appending the same type (float64
) such that NumPy can compute the determinant of your system with LAPACK (see this answer for more info). You are currently appending <class 'sympy.core.numbers.Float'>
- your errror message is telling you that you have an incorrect type signature for usage.
To correct this issue, you can simply append numpy.array
with a dtype
specification for float64
as you did above
for fnc in fncList: res2 = fnc for i in range(len(varz)): res2 = res2.subs(varz[i], x0[i]) fx0.append(numpy.array(res2, dtype='float'))