| > I *really* think solve() should return a Set, not an ill-defined ad-hoc
| > structure. Infinite solution sets don't necessarily have a parameter
| > (for instance x == tan(x)), or they could be more than one family of
| > solutions or more than one parameter, or the solution set could contain
| > families with different dimensionalities. There are a lot of possible
| > situations but they can all be represented by a set, because that's what
| > solving an equation means: finding the set of values of the variables
| > for which the equation holds.
|
| +1
|
| Mathematically it is a set, so we should return a set (and not a list
| as currently for the onedimensional case). However, we might want to
| return additional information like multiplicities, this could be
| integrated in a subclass of a set.
|
I don't think we should get hung up on the fact that a set of solutions should
be returned as a literal set. How that set gets represented/presented is just
an interface issue. I don't see anything wrong with presenting the set as
elements in a list. The list representation also allows for unambiguous,
non-redundant representation of the symbols and their values. And look at how
easy it is to make a replacement dictionary from a list as compared to a
dictionary...and I challenge anyone to try do the same with a set in as compact
a fashion:
h[4] >>> l=[(x,y),(1,2),(3,4)]
h[4] >>> reps=dict(zip(l[0],l[1])) # first solution is in position 1 of the
list
h[4] >>> reps
{x: 1, y: 2}
h[4] >>> d={x:[1,3],y:[2,4]}
h[4] >>> k=d.keys();reps=dict([(k[i],d[k[i]][0]) for i in
range(len(d[k[0]]))]) # first soln is element 0
h[4] >>> reps
{x: 1, y: 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.