Comment #6 on issue 2750 by [email protected]: solve could do a better job
with over determined systems
http://code.google.com/p/sympy/issues/detail?id=2750
Regarding getting some result from the system for a single symbol: this is
how the current solver in the pull request behaves:
eqs
(I1 - I2 - I3, I3 - I4 - I5, I4 + I5 - I6, -I1 + I2 + I6, -2*I1 - 2*I3 -
2*I5 -
3*I6 - dI1/2 + 12, -I4 + dQ4, -I2 + dQ2, 2*I3 + 2*I5 + 3*I6 - Q2, I4 - 2*I5
+ 2*
Q4 + dI4)
syms = reduce(set.union, [fi.free_symbols for fi in eqs])
for s in syms:
... ans = solve(eqs, s)
... if ans is not None:
... print s, ans
...
dI4 {dI4: -I4 + 2*I5 - 2*Q4}
Q4 {Q4: -I4/2 + I5 - dI4/2}
dI1 {dI1: -4*I1 - 4*I3 - 4*I5 - 6*I6 + 24}
dQ2 {dQ2: I2}
Q2 {Q2: 2*I3 + 2*I5 + 3*I6}
dQ4 {dQ4: I4}
It returns results from equations in which the requested symbol appears
once.
for s in syms:
... for e in [ei for ei in eqs if ei.has(s)]:
... print s, e
... print
...
dI4 I4 - 2*I5 + 2*Q4 + dI4
I3 I1 - I2 - I3
I3 I3 - I4 - I5
I3 -2*I1 - 2*I3 - 2*I5 - 3*I6 - dI1/2 + 12
I3 2*I3 + 2*I5 + 3*I6 - Q2
Q4 I4 - 2*I5 + 2*Q4 + dI4
I2 I1 - I2 - I3
I2 -I1 + I2 + I6
I2 -I2 + dQ2
dI1 -2*I1 - 2*I3 - 2*I5 - 3*I6 - dI1/2 + 12
I6 I4 + I5 - I6
I6 -I1 + I2 + I6
I6 -2*I1 - 2*I3 - 2*I5 - 3*I6 - dI1/2 + 12
I6 2*I3 + 2*I5 + 3*I6 - Q2
dQ2 -I2 + dQ2
I1 I1 - I2 - I3
I1 -I1 + I2 + I6
I1 -2*I1 - 2*I3 - 2*I5 - 3*I6 - dI1/2 + 12
Q2 2*I3 + 2*I5 + 3*I6 - Q2
I5 I3 - I4 - I5
I5 I4 + I5 - I6
I5 -2*I1 - 2*I3 - 2*I5 - 3*I6 - dI1/2 + 12
I5 2*I3 + 2*I5 + 3*I6 - Q2
I5 I4 - 2*I5 + 2*Q4 + dI4
dQ4 -I4 + dQ4
I4 I3 - I4 - I5
I4 I4 + I5 - I6
I4 -I4 + dQ4
I4 I4 - 2*I5 + 2*Q4 + dI4
You could then pick which you want and eliminate it from the equation set
and continue.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.