There are flags you can pass to solve() to make it always return a
consistent type. For instance, dict=True. This is recommended if you
are processing the solutions programmatically.

Aaron Meurer

On Fri, Feb 28, 2020 at 2:29 AM Thomas Ligon <[email protected]> wrote:
>
> The problem is solved. The subs() problem was also caused by overlooking the 
> list returned by solve().
> I admit that I was misguided by the fact that I previously worked a lot with 
> the MATLAB symbolic math toolbox. In it, solve() for multiple variables 
> returns a struct, and for a single variable does not return a struct with a 
> single element, but the element itself. Because of that, I needed to write 
> code that treated the single value as a special case. Now, I prefer the way 
> that Sympy does it, because the code would be simpler, just a loop over a 
> variable number of elements that might be one.
> This means:
> ex129a = ex129.subs(bm2, ex132a)
> may have problems when given a list instead of an expression.
>
> --
> 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/e0d84f45-363e-45cc-86bf-261164d75eee%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%3D6Kuk1nc1OT5GiudVwe6VUvWL_qi8ZR%2BBMiqeB5m2Y6w3g%40mail.gmail.com.

Reply via email to