Hi,
On 20 April 2011 11:55, Aaron S. Meurer <[email protected]> wrote:
> The Solution class is indeed a good idea.
>
> I think it would be best to have a unified data structure independent of
> the number of solutions. The reason is that it is not clear from the outset
> how many solutions an equation or system of equations will have. That is
> why I think it would be better to have a list always or a dictionary always
> (or a list of dictionaries always). The list of dictionaries idea is one of
> the better ones, in my opinion.
>
This is what Mathematica does (for example) (it gives a list of rules, which
is a list of dicts in Python's terminology). There is one more issue that
has to be taken into account: currently it's not easy to substitute results
from solve() back to the original equation/set of equations (in a systematic
way).
>
> Aaron Meurer
>
> On Apr 20, 2011, at 3:57 AM, Alexey U. Gudchenko wrote:
>
> > 20.04.2011 11:45, Chris Smith пишет:
> >>> Solution class is needed indeed. Also, to recognize correctly the
> >>> number of solutions with the help of `len` procedure. If we return the
> >>> dictionary it is not clear:
> >>>
> >>>>>> len({x: 3, y: 2})
> >>> 2
> >>>>>> [{x: 3, y: 2}, {x: 8, y: -3}]
> >>> 2 (too)
> >>>
> >>
> >> Until a Solution class exists, the multi-solution case should come back
> like the single solution: as a list.
> >> So solutions will look like `[1]`, ` [1, 2]`, `[{x: 3, y: 2}]` or `[{x:
> 3, y: 2}, {x: 8, y: -3}]`.
> >>
> >
> > May be....
> > As temporary solution.
> >
> > But if a Solution class will exists, it is not necessary to result a
> > list if one solution only. I have pointed out an advantage of this case
> > (strict typified interface of function definition) and disadvantage (not
> > convenient for end-user).
> >
> > But I can't decide it, because I do not know exactly the politic way in
> > SumPy for this cases (how to manage with variant results).
> >
> > My opinion that it would be rather suitable:
> > `1`, ` [1, 2]`, `{x: 3, y: 2}` or `[{x: 3, y: 2}, {x: 8, y: -3}]`
> >
> > If Solution class exist, then I check type (list of Solutions or
> > Solution itself) with easy.
> >
> > Also, taking into account Mateusz's notes (e.g. about sorting of
> > dictinary) I think that the issue for Solution class should be created
> > in issue-tracker too.
> >
> > --
> > 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.
> >
>
> --
> 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.