I just noticed this behavior of solve:
In [258]: print ([b.coeff(eps**i) for i in range(2, 8)])
[2*alpha2 - 2*b2 + 1, -alpha2 + 2*b2, -alpha2*b2 + 2*alpha4 + b2**2 -
2*b4, -alpha4 + 2*b4, -alpha2*b4 - alpha4*b2 + 2*alpha6 + 2*b2*b4 -
2*b6, -alpha6 + 2*b6]
In [259]: solve([b.coeff(eps**i) for i in range(2, 8)])
Out[259]: [{α₂: -1, α₄: 1/4, α₆: -1/8, b₂: -1/2, b₄: 1/8, b₆: -1/16}]
Can someone explain why it returns the dict inside a list? Is that
necessary? In 0.7.1, we got:
In [1]: a = S("[2*alpha2 - 2*b2 + 1, -alpha2 + 2*b2, -alpha2*b2 +
2*alpha4 + b2**2 - 2*b4, -alpha4 + 2*b4, -alpha2*b4 - alpha4*b2 +
2*alpha6 + 2*b2*b4 - 2*b6, -alpha6 + 2*b6]")
In [2]: solve(a)
For nonlinear systems of equations, symbols should be
given as a list so as to avoid ambiguity in the results.
solve sorted the symbols as [alpha2, alpha4, alpha6, b2, b4, b6]
Out[2]: [(-1/2, 1/8, -1/16, -1, 1/4, -1/8)]
So this is better, but I don't see why we don't just return the dict.
(by the way, that should have been a warning, not a print statement!)
Aaron Meurer
--
You received this message because you are subscribed to the Google Groups
"sympy" 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?hl=en.