Re: [sympy] Re: Solving for a matrix?

2018-03-14 Thread Matthias Geier
Thanks Leonid, that clears everything up for me! cheers, Matthias On Wed, Mar 14, 2018 at 5:06 PM, Leonid Kovalev wrote: > I understood what's going on. The variables a0, a1, a2, a3 are a distraction > since they are not to appear in the solution. What matters is their

Re: [sympy] Re: Solving for a matrix?

2018-03-14 Thread Leonid Kovalev
I understood what's going on. The variables a0, a1, a2, a3 are a distraction since they are not to appear in the solution. What matters is their coefficients in b, which naturally form a matrix. >>> sp.Matrix([[eq.coeff(v) for v in a] for eq in b]) Matrix([ [0, 0, 0, 1], [1, 1, 1, 1], [0, 0, 1,

Re: [sympy] Re: Solving for a matrix?

2018-03-14 Thread Jason Moore
Matrices have a number of solvers, check out: http://docs.sympy.org/latest/modules/matrices/matrices.html#linear-algebra If you have a simple linear system, I recommend LUsolve(). moorepants.info +01 530-601-9791 On Wed, Mar 14, 2018 at 4:20 AM, Matthias Geier wrote:

Re: [sympy] Re: Solving for a matrix?

2018-03-14 Thread Matthias Geier
Thanks a lot for your answer, Leonid! I think I'm starting to see the problem ... When I'm solving the system of equations, I get many solutions, most of them containing a0, a1, a2 and a3. However, I'm just interested in exactly one of those solutions where all occurrences of a0, a1, a2 and a3

[sympy] Re: Solving for a matrix?

2018-03-13 Thread Leonid Kovalev
You have 4 equations with 16 unknowns, so there are going to be a lot of solutions. Many SymPy functions struggle with M[i, j] construction which creates MatrixElement instead of an ordinary Symbol. I would use a Matrix filled with Symbols: M = sp.Matrix(sp.symarray('M', (4, 4))) sp.solve(a