The first steps for implementing a initial value and systems solver are here https://github.com/sympy/sympy/pull/1322
Besides an easy rebase/merge it needs rewriting a number of test. Otherwise it works well in non-corner cases. Help would be appreciated. On 22 November 2012 02:05, Aaron Meurer <[email protected]> wrote: > On Wed, Nov 21, 2012 at 5:54 PM, MatthiasK <[email protected]> wrote: >> >> Hi, >> I am a bit confused about the state of solving ODE's in sympy. It seems >> that I cannot directly solve initial value problems, right? > > > Yes, but it should be simple to implement. Just no one has done it yet. > >> >> >> Is there a good way to solve the resulting equation system in simple >> cases? >> e.g. my code right now: >> t = sym.Symbol('t') >> i = sym.Function('i') >> prob = Lsym.Derivative( i(t), t, 2 ) + sym.Derivative(i(t), t) + i(t) >> sol = sym.dsolve(prob, i(t)) >> >> now I'd like to do something like: >> equations = [sol.subs(t,0) == var(1), sym.diff(sol,t).subs(t,0) == var(2)] >> solve(equations) >> >> sym.diff(sol,t) does not return a fully substituted result however. >> Instead I receive: >> Subs(Derivative(i(_t) == (_t*C2 + C1)*exp(-_t), _t), (_t,), (0,)) >> >> Can I still solve with this somehow or do I need to rethink my approach? > > > Eq() does not automatically distribute most operations across it, > unfortunately (see https://code.google.com/p/sympy/issues/detail?id=1931 and > https://code.google.com/p/sympy/issues/detail?id=1932). Your best bet is to > just work with the solution as a regular expression, i.e., work with sol.lhs > - sol.rhs (solve() assumes that just plain expressions are equal to 0). > Then what you are trying will work. Or, since this particular solution is > already solved for i(t), you can just work with the right-hand side. > > Aaron Meurer > >> >> Best Regards, >> Matthias >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/sympy/-/0eDn9XsXbZEJ. >> 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. -- 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.
