[sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-02 Thread Shriramana Sharma
Hello. I have the following equations (all equal to zero) which I am able to solve using SymPy for the Ep,De and La subscripted variables after supplying the DeltaP() DeltaQ() and mu values: 2*Ep(0)/7 + Ep(1)/7 + 2*Ep(2)/35 + Ep(3)/70 - La(3) Ep(0)/7 + 6*Ep(1)/35 + 9*Ep(2)/70 + 2*Ep(3)/35 + La(2)

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-02 Thread Chris Smith
I don't think there is a way to get back the matrices for the input equations, but I think the following will give you what you want. It can be streamlined, but you can see the steps below: >>> eqs=Tuple(*eqs) >>> eqs.atoms(Function) set([La(3), Ep(0), DeltaQ(1, 0), DeltaQ(0, 0), Ep(2), Ep(3), De(

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-02 Thread Chris Smith
If you could take a moment to look over https://github.com/sympy/sympy/pull/1682 you can solve for indexed quantities without having to do the dummy substitution yourself. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send emai

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread Shriramana Sharma
On Mon, Dec 3, 2012 at 12:28 PM, Chris Smith wrote: > If you could take a moment to look over > https://github.com/sympy/sympy/pull/1682 you can solve for indexed > quantities without having to do the dummy substitution yourself. Hey nice! Do I understand correctly this mean that pulling the late

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread Shriramana Sharma
On Mon, Dec 3, 2012 at 4:25 PM, Shriramana Sharma wrote: > Hey nice! Do I understand correctly this mean that pulling the latest > Git (yes I've become a cloner) will allow me to use IndexedBase > objects like this? OK now pulled latest git but I understand this is not into trunk yet. BTW from th

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread Chris Smith
> > OK now pulled latest git but I understand this is not into trunk yet. > BTW from the example in the code: > > >>> from sympy import Indexed, IndexedBase, Tuple > >>> A = IndexedBase('A') > >>> eqs = Tuple(A[1] + A[2] - 3, A[1] - A[2] + 1) > >>> solve(eqs, eqs.atoms(Indexed)) > {A[1]: 1, A[2]: 2

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread Chris Smith
On Mon, Dec 3, 2012 at 4:45 PM, Shriramana Sharma wrote: > A = IndexedBase('A') > >>> eqs = Tuple(A[1] + A[2] - 3, A[1] - A[2] + 1) > After the latest commit "it just works": >>> solve((A[1] + A[2] - 3, A[1] - A[2] + 1)) [{A[2]: 2, A[1]: 1}] -- You received this message because you are subscr

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread smichr
numVars = ( n + 1 ) * 3 > for i in range ( numVars ) : > eqnList [ i ] = eqnList [ i ] . expand () > print ( eqnList [ i ] ) > > # the linear equation system is expressed in matrix form as: eqnCoeffs > * eqnVars = eqnConstants > > eqnCoeffs = zeros ( numVars,

Re: [sympy] How to find out the matrices that solve produces to solve a set of equations

2012-12-03 Thread Shriramana Sharma
On Mon, Dec 3, 2012 at 11:25 PM, smichr wrote: > That's the verbose way to say eqnCoeffs = > Matrix(eqn).jacobian(Matrix(eqnVars)) and eqnConstants = eqnCoeffs - > Matrix(eqn). Here's a toy system: > (though not a lot, but th eqns = (2*x+y+3,x-y-2) E = Matrix(eqns) X = Matrix([x, y]