Ronan Lamy wrote:
> Le dimanche 24 avril 2011 à 06:56 +0545, Chris Smith a écrit :
>> Vinzent Steinberg wrote:
>>> On 22 Apr., 16:53, "Chris Smith" <[email protected]> wrote:
>>>> 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)]
>>>
>>> You could use as well set([...]) here. There is no reason IMHO to
>>> use a list.
>>
>> In the list, that is a literal x and y -- symbols. That's what makes
>> the list less noisy: you get the symbols once, right at the start,
>> and then all the solutions. The dictionary is just too busy with
>> redundant symbols. Easy to use, hard to look at.
>
> But you know the symbols anyway since you just used them to get the
> list of solutions. So what's wrong with:
>
You may have not requested an explicit set of symbols and are willing to take
whatever you get...in that case you need to know what you got.
h[2] >>> solve([x+y-3,x**2+y-5])
[(-1, 4), (2, 1)]
And if there are many symbols and you just want *some* solution, then it's nice
to let solve handle figuring out which set of symbols it can solve for.
--
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.