Does anybody know if the following sorts of constraints can be solved to give the subsets of nonnegative integers that satisfy them:
i+j=2 k+l=4 m+n=3 i*k+l+m=3 j*k+l+n=8 The only thing I know to do is just check all possibilities: def tallies(n, *syms): for p in partitions(n, len(syms)): take = sum([v for v in p.values()]) vals = flatten([[k]*v for k, v in p.iteritems()]) for s in subsets(syms, take): d = defaultdict(int) for i, si in enumerate(s): d[si] = vals[i] yield d for dd in cartes(tallies(2,i,j), tallies(4,k,l), tallies(3,m,n)): d = defaultdict(int) for di in dd: d.update(di) if d[i]*d[k]+d[l]+d[m]==3 and d[j]*d[k]+d[l]+d[n]==8: print dict(d) {k: 2, m: 1, j: 2, l: 2, n: 2, i: 0} I suppose that it might be better to work backward from the more complicated constraints (like the i*k+l+m == 3). Does anyone have other suggestions/algorithms? /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/b-Co8eejgRwJ. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.