Changing the output type could break code that solves a specific equation. I am doubtful whether any users actually understand the output type behavior of solve without the dict=True flag. So personally I think we should clean it up. We already recommend using dict=True to get consistent output types, and this would only affect users who aren't doing that.
Aaron Meurer On Thu, Mar 3, 2022 at 8:28 AM Chris Smith <[email protected]> wrote: > > The output from solve for algebraic equations is not usable without testing > output because of the variable types of output. > > CASE 1: If no variables are given we get the following from the input: > * univariate equation -> list of values > >>> solve(x**2 - 4) > [-2, 2] > * multivariate equation -> list of one or more dictionaries > >>> solve(x**2 - y) > [{y: x**2}] > > CASE 2: If variable(s) are given we get > * tuples of solutions > >>> solve([x**2-y],x) > [(-sqrt(y),), (sqrt(y),)] > * dictionary for single solution > >>> solve([x-y],x) > {x: y} > > Although the dict=True or set=True will give a standard output, can we at > least unify the case for when variables are given so we always get a list of > one or more dictionaries? So the above would be `[{x: -sqrt(y)}, {x: > sqrt(y)}]` and `[{x: y}]`, respectively. This would then make `solve` always > give a list of a) values for a univariate expression, b) a list of one or > more dictionaries for every other case. (Case (a) will give a list of > dictionaries if `dict=True`.) > > /c > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/c391d370-5d64-4b94-ae15-a56901bbb219n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L_8e_%2BgNpnYpDCNAEg-biiTzTz7Qjiw4JEvsbrAcfchA%40mail.gmail.com.
