OK, it's not too bad to have it solve the relationships such that the
spider relationships are positive (since those relationships tell you
the number of pigs and chickens there are):
>>> var('spiders chickens pigs',integer=True, positive=True)
(spiders, chickens, pigs)
>>> solve([Eq(chickens+pigs+spiders, 20),
Eq(2*chickens+4*pigs+8*spiders,56)])
{chickens: 2*spiders + 12, pigs: -3*spiders + 8}
>>> solve([Ge(v,0) for v in _.values()])
And(-6 <= spiders, spiders <= 8/3)
>>> condition = _
That And can be used to test values for spiders if desired:
>>> [i for i in range(8) if condition.subs(spiders, i)]
[0, 1, 2]
--
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.