On Wednesday, 9 November 2016 11:18:56 UTC+1, Bjorn wrote: > > Hi, I am a sympy newbie, and I would like to use sympy to solve equation > systems. I don't expect these systems to be huge or complicated. > /.../ > - has this been done before? I would like to use tested code if possible. >
Hi, I haven't seen exactly this approach, it looks fine, however I would recommend using the parse function if you will be parsing user-provided strings. > - is it possible to incorporate units in the calculations? This issue > <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fsympy%2Fsympy%2Fissues%2F5156&sa=D&sntz=1&usg=AFQjCNEUzIU4H_iPgP9xcz4Mk8KlCZJHWA> > > suggests that it is not. > I typically do dedimensionalisation at the interface (removing units before manipulating the expressions, and reattaching them before return). Ideally SymPy would do this for the user, but if you need to use e.g. numerical non-linear solvers in e.g. SciPy you would still need to do this. > - are there any immediately apparent gotchas the code above? I would like > to have a system for solving equations not much more complex than the > example. > It really depends on what systems you will be solving. As long as they are linear SymPy will provide you with solutions (but expressions may grow unmanageably large quite quickly as the system grows if done symbolically). SymPy is also able to solve many non-linear equations. What are your overall goal here? (ethanol density is not linear with respect to mass fraction water to start with..) Best regards, Björn Dahlgren -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b65ae6a9-04fc-4352-aa0d-9a58464fa4c7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
