There are possibilities to go from nonlinear to linear e.g.:
In [6]: x, y = symbols('x, y', cls=Function)
In [7]: eqs = [x(t).diff(t)**2 - y(t)**2, y(t).diff(t)**2 - x(t)**2]
In [8]: eqs
Out[8]:
⎡ 2 2⎤
⎢ 2 ⎛d ⎞ 2 ⎛d ⎞ ⎥
⎢- y (t) + ⎜──(x(t))⎟ , - x (t) + ⎜──(y(t))⎟ ⎥
⎣ ⎝dt ⎠ ⎝dt ⎠ ⎦
In [9]: solve(eqs, [x(t).diff(t), y(t).diff(t)], dict=True)
Out[9]:
⎡⎧d d ⎫ ⎧d d ⎫
⎧d d ⎫ ⎧d d ⎫⎤
⎢⎨──(x(t)): -y(t), ──(y(t)): -x(t)⎬, ⎨──(x(t)): -y(t), ──(y(t)):
x(t)⎬, ⎨──(x(t)): y(t), ──(y(t)): -x(t)⎬, ⎨──(x(t)): y(t), ──(y(t)):
x(t)⎬⎥
⎣⎩dt dt ⎭ ⎩dt dt ⎭
⎩dt dt ⎭ ⎩dt dt ⎭⎦
On Mon, 16 Mar 2020 at 15:48, Milan Jolly <[email protected]> wrote:
>
> Thanks for the suggestion, I have started with the design for these solvers.
> But I have one doubt, namely since now we are using linear_eq_to_matrix
> function to check if the system of ODEs is linear or not, would we require
> the canonical rearrangements part? Or rather are there other cases when we
> can reduce non-linear ODEs into linear ODEs.
>
> On Monday, March 16, 2020 at 2:53:57 AM UTC+5:30, Oscar wrote:
>>
>> That seems reasonable to me. Since the plan is a total rewrite I think
>> that it would be good to put some time in at the beginning for
>> designing how all of these pieces would fit together. For example even
>> if the connected components part comes at the end it would be good to
>> think about how that code would fit in from the beginning and to
>> clearly document it both in issues and in the code.
>>
>> Getting a good design is actually more important than implementing all
>> of the pieces. If the groundwork is done then other contributors in
>> future can easily implement the remaining features one by one. Right
>> now it is not easy to improve the code for systems because of the way
>> that it is structured.
>>
>> On Sun, 15 Mar 2020 at 19:27, Milan Jolly <[email protected]> wrote:
>> >
>> > Thanks for your reply. I have planned a rough layout for the phases. I
>> > took a lot of time this past month to understand all the mathematics that
>> > will be involved and have grasped some part of it.
>> >
>> > If I am lucky and get selected for GSOC'20 for this organisation, then the
>> > below is the rough plan. Please comment on suggestions if necessary.
>> >
>> > Community Bonding phase:
>> > 1. Using matrix exponential to solve first order linear constant
>> > coefficient homogeneous systems(n equations).
>> > 2. Adding new test cases and/or updating old ones.
>> > 3. Removing and closing related issues if they are solved by the addition
>> > of this general solver. Identifying and removing the special cases solvers
>> > which are covered by this general solver.
>> >
>> > Phase I:
>> > 1. Adding technique to solve first order constant coefficient
>> > non-homogeneous systems(n equations).
>> > 2. Adding the functionality that reduces higher order linear ODEs to first
>> > order linear ODEs(if not done already, and if done, then incorporating it
>> > to solve higher order ODEs).
>> > 3. Adding a special case solver when non-constant linear first order ODE
>> > has symmetric coefficient matrix.
>> >
>> > Phase II:
>> > 1. Adding technique to solve non-constant non-homogeneous linear ODE based
>> > off the solver added by the end of Phase I.
>> > 2. Evaluating and eliminating unnecessary solvers.
>> > 3. Closing related issues solved by the general solvers and identifying
>> > and removing unwanted solvers.
>> > 4. Adding basic rearrangements to simplify the system of ODEs.
>> >
>> > Phase III:
>> > 1. Dividing the ODEs by evaluating which sub-systems are weakly and
>> > strongly connected and handling both of these cases accordingly.
>> > 2. Adding a special case solver where the independent variable can be
>> > eliminated and thus solving the system becomes easier.
>> > 3. Wrapping things up: adding test cases, eliminating unwanted solvers and
>> > updating documentation.
>> >
>> > This is the rough layout and my plan for summer if I get selected. If this
>> > plan seems ok then I would include this plan in my proposal.
>> >
>> > On Saturday, March 14, 2020 at 9:37:31 PM UTC+5:30, Oscar wrote:
>> >>
>> >> It's hard to say how much time each of these would take. The roadmap
>> >> aims to completely replace all of the existing code for systems of
>> >> ODEs. How much of that you think you would be able to do is up to you
>> >> if making a proposal.
>> >>
>> >> None of the other things described in the roadmap is implemented
>> >> anywhere as far as I know. Following the roadmap it should be possible
>> >> to close all of these issues I think:
>> >> https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3Asolvers.dsolve.system
>> >>
>> >> On Fri, 13 Mar 2020 at 22:30, Milan Jolly <[email protected]> wrote:
>> >> >
>> >> > I have mostly read and understood matrix exponentials and Jordan forms
>> >> > along with the ODE systems roadmap. But I am unclear as to what has
>> >> > already been done when it comes to implementing the general solvers.
>> >> > For example: The matrix exponentials part has already been implemented
>> >> > and now I have a PR that has revived the matrix exponential code.
>> >> >
>> >> > I want to make a proposal and contribute to make these general solvers
>> >> > during this summer if my proposal gets accepted. But I am unclear what
>> >> > should be the parts I need to work during community bonding period,
>> >> > phase 1, phase 2 and phase 3 as I am unaware how much time each part of
>> >> > the general solvers would take.
>> >> >
>> >> > If someone can help me in this regard(helping me with these 2
>> >> > questions) then it would be great.
>> >> >
>> >> >
>> >> > On Tue, Feb 25, 2020, 5:09 AM Milan Jolly <[email protected]> wrote:
>> >> >>
>> >> >> I will go through the roadmap. Also, I will work on reviving and
>> >> >> finishing the stalled PRs namely the matrix exponential one for now as
>> >> >> I am interested in working towards this. Thanks.
>> >> >>
>> >> >> On Mon, Feb 24, 2020, 9:56 PM Oscar Benjamin <[email protected]>
>> >> >> wrote:
>> >> >>>
>> >> >>> This section in the roadmap refers to existing stalled PRs trying to
>> >> >>> fix the n-equations solver for constant coefficient homogeneous ODEs
>> >> >>> which is the first step:
>> >> >>> https://github.com/sympy/sympy/wiki/ODE-Systems-roadmap#constant-coefficients---current-status
>> >> >>>
>> >> >>> A first step would be to attempt to revive one or both of those PRs
>> >> >>> and finish them off.
>> >> >>>
>> >> >>> On Mon, 24 Feb 2020 at 05:59, Milan Jolly <[email protected]> wrote:
>> >> >>> >
>> >> >>> > So, I am interested in rewriting parts of the current ODE as
>> >> >>> > discussed in the roadmap. Is there any work started in that
>> >> >>> > direction and if not then can I create a PR for the same?
>> >> >>> >
>> >> >>> > On Mon, Feb 24, 2020, 2:52 AM Oscar Benjamin <[email protected]>
>> >> >>> > wrote:
>> >> >>> >>
>> >> >>> >> The current refactoring effort applies only to the case of solving
>> >> >>> >> *single* ODEs. The ODE systems code also needs to be refactored but
>> >> >>> >> (in my opinion) needs a complete rewrite. That is what the roadmap
>> >> >>> >> is
>> >> >>> >> about (it describes how to rewrite everything). The code for
>> >> >>> >> systems
>> >> >>> >> of ODEs should also get refactored in the process but there is no
>> >> >>> >> need
>> >> >>> >> to "refactor" it in its current form if it is in fact being
>> >> >>> >> *completely* rewritten: we can just make sure that the new code is
>> >> >>> >> written the way we want it to be.
>> >> >>> >>
>> >> >>> >> On Sun, 23 Feb 2020 at 19:52, Milan Jolly <[email protected]>
>> >> >>> >> wrote:
>> >> >>> >> >
>> >> >>> >> > Ok so I have gone through the links suggested and I have
>> >> >>> >> > realised that as far as ODE module is concerned, refactoring is
>> >> >>> >> > the most important task. But, as far as that is concerned, I
>> >> >>> >> > think Mohit Balwani is working on this for a while and I want to
>> >> >>> >> > limit any collisions with my co-contributors. So, I have couple
>> >> >>> >> > of ideas to work on:
>> >> >>> >> > 1. Helping to extend the solvers, i.e.implementing a fully
>> >> >>> >> > working n-equations solver for constant coefficient homogeneous
>> >> >>> >> > systems. This is from the ODE systems map. I am interested in
>> >> >>> >> > working on this but I understand that it might be hard to work
>> >> >>> >> > upon it while refactoring takes place. Still, if its possible to
>> >> >>> >> > work on this and if no one else has started to work in this
>> >> >>> >> > direction yet then I am willing to work for this.
>> >> >>> >> > 2. Using connected components function implemented by Oscar
>> >> >>> >> > Benjamin in https://github.com/sympy/sympy/pull/16225 to enhance
>> >> >>> >> > ODE solvers and computing eigen values faster as mentioned here
>> >> >>> >> > https://github.com/sympy/sympy/issues/16207 .
>> >> >>> >> > 3. This idea is not mentioned in the ideas page and is something
>> >> >>> >> > of my own. If there is anything possible, then I can also work
>> >> >>> >> > on extending functions like maximum, minimum, argmax, argmin,
>> >> >>> >> > etc in calculus module. I have been working on the issue
>> >> >>> >> > https://github.com/sympy/sympy/pull/18550 and I think there is
>> >> >>> >> > some scope to extend these functionalities.
>> >> >>> >> >
>> >> >>> >> > On Sunday, February 23, 2020 at 1:32:20 AM UTC+5:30, Milan Jolly
>> >> >>> >> > wrote:
>> >> >>> >> >>
>> >> >>> >> >> Hello everyone,
>> >> >>> >> >>
>> >> >>> >> >> My name is Milan Jolly and I am an undergraduate student at
>> >> >>> >> >> Indian Institute of Technology, Patna. For the past 2 month, I
>> >> >>> >> >> have been learning and exploring sympy through either
>> >> >>> >> >> contributions, reading documentation or trying examples out.
>> >> >>> >> >> This last month I have learned a lot of new things thanks to
>> >> >>> >> >> the well designed code-base, the structured way this community
>> >> >>> >> >> works and most importantly the maintainers who make it work. It
>> >> >>> >> >> has been a pleasure to be a part of the community.
>> >> >>> >> >>
>> >> >>> >> >> I am interested in participating for GSoC this year and I would
>> >> >>> >> >> like to work for this org during the summers if I am lucky. I
>> >> >>> >> >> particularly want to work on improving the current ODE module
>> >> >>> >> >> as it is given in the idea list. There is a lot of work that
>> >> >>> >> >> needs to be taken care of like:
>> >> >>> >> >> 1. Implementing solvers for solving constant coefficient
>> >> >>> >> >> non-homogeneous systems
>> >> >>> >> >> 2. Solving mixed order ODEs
>> >> >>> >> >> 3. Adding rearrangements to solve the system
>> >> >>> >> >>
>> >> >>> >> >> These are not my ideas but I have taken inspiration from the
>> >> >>> >> >> ideas page but I am up for working on these. If someone can
>> >> >>> >> >> guide me regarding this then it would be really helpful.
>> >> >>> >> >
>> >> >>> >> > --
>> >> >>> >> > 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/1033f581-abbb-4be5-a5b2-1988f4261535%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/CAHVvXxTeWturK6WmtHKxakLqbV1yhp5_KoTPs8vPtmbu8%3D2VxQ%40mail.gmail.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/CAMrWc1BZKcwjFvVQwZZ80P6s-CP62Tn_VN30zBEdjmqhrN44DA%40mail.gmail.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/CAHVvXxRGFJC%2BGeowaNJcVFQsQsGq%2Bh0SW-jmYezsSzU5%3DvipcA%40mail.gmail.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/CAMrWc1CYmTAwU4mFX%3DkOdZnmkzosN14VUAQBdteUETXas58n1w%40mail.gmail.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/b2d61327-da27-4baf-a753-cf4069abfc78%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/38ad9558-b8e0-465a-aeb4-5ea782144b55%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/CAHVvXxTHCojv8_4pfZ33kCJxiOTbL5%2BvDvEUGxEdOdyQkEETVA%40mail.gmail.com.