Hi,

On 20 April 2011 08:29, Alexey U. Gudchenko <[email protected]> wrote:

> 20.04.2011 09:45, Chris Smith пишет:
> > Aaron S. Meurer wrote:
> >>> On Apr 19, 2011, at 9:24 AM, Vinzent Steinberg wrote:
> >>>
> >>>> On Apr 18, 9:43 pm, "Aaron S. Meurer" <[email protected]> wrote:
> >>>>>>>>> solve((x+y-5,x-y-1),x,y) # a system with a single solution
> >>>>>>    {x: 3, y: 2}
> >>>>>>>>> solve((x+y-5,x-y**2+1),x,y) # s system with two solutions
> >>>>>>    [(3, 2), (8, -3)]
> >>>>>
> >>>>> Wow, do we really do that?  That's a horrible convention.
> >>>>
> >>>> This is indeed inconsistent. Do you think the latter should be
> >>>> default, even if there is only one solution?
> >>>>
> >>>> Vinzent
> >>>
> >>> Either that or always return a tuple as values in the dictionary.
> >
> > So if there are 4 solution (x, y) = (1, 2), (1, 3), (2, 4), (2, 5) you
> would get the following?
> >
> >     ans = {x:(1, 1, 2, 2), y:(2, 3, 4, 5)}
> >
> >
>
> As variant:
> One solution:
>        {x: 3, y: 2}
> Many solutions (therefore means a list of solutions):
>        [{x: 3, y: 2}, {x: 8, y: -3}]
>

This is probably the best solution (as long as we stay with built-in data
structures), because this gives the most information and we should also take
over-determined systems into account. A problem with dicts is that order of
elements depends on the printer, not on the solve order (e.g. solve(..., [y,
x]) may give {x: ..., y: ...}), so the result may be misleading (ordered
dictionary type was added in Python 2.7). Perfect solution would be to have
a Solution class which would preserve all information about a solution and
it would allow conversion to dict and/or tuple.


>
> Yes, duplicities "x", "y", but it is normal, if we represent list of
> objects as string.
>
> --
> Alexey U.
>
> --
> 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.
>
>
Mateusz

-- 
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.

Reply via email to