GSoC 2016 - Classical Mechanics: Efficient Equation of Motion Generation with Python

183 views
Skip to first unread message

James Milam

unread,
Mar 8, 2016, 3:49:38 PM3/8/16
to sympy
Hi all,

I am currently pursuing a master's degree in mechanical engineering at the University of Florida and am interested in participating in GSoC with the sympy project. I have recently completed a course on analytical dynamics which lead to my interest in working with the equations of motion generator ideas posted on the ideas page. I would like to work on increasing the efficiency of equation of motion generation with python or generalizing the equation of motion generation classes. I have already read through the sympy tutorial and the development workflow pages in addition to submitting a pull request on some basic typos encountered in the tutorial.

I was wondering if the two equation of motion project ideas I mentioned were inherently separate ideas or if they could be combined to some extent? Also any other advice/suggestions towards the GSoC application would be greatly appreciated.

Thanks

Jason Moore

unread,
Mar 8, 2016, 3:54:53 PM3/8/16
to sy...@googlegroups.com
The two equation of motion ideas can be combined. The C++ is a bigger effort because we do not yet have an easy way to replace SymPy objects with C++ backed objects in a seamless way. The problem is the same, we'd like to speed up the EoM formulations and the linearizations. There may be a lot to gain by simply improving the Python code (which will help all of SymPy). But for optimal speed, the C++ solution (SymEngine) is likely the best way.

See this thread for some starting points: https://groups.google.com/forum/#!searchin/sympy/pyinstrument/sympy/KFyfC4gQUSQ/sNwKzAFVAwAJ

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
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/ce005f54-45fc-443e-9bef-b8cd97cf28a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alan Bromborsky

unread,
Mar 8, 2016, 4:06:10 PM3/8/16
to sy...@googlegroups.com
Has anyone looked at parallel python to speed things up (where applicable of course)?

Jason Moore

unread,
Mar 8, 2016, 4:14:05 PM3/8/16
to sy...@googlegroups.com
I've checked that project out before. I'm not sure why I concluded not to look deeper into it.

It is likely that some SymPy actions can be sped up with the multiprocessing module without having to introduce any dependencies. I'm not sure if these things work great cross platform though.

Parallel options should be investigated as part of this project idea. There may be some good solutions. But ultimately Python has the GIL which makes it hard to do really nice parallel code. There are ways around that, but it's not always so clean.

Alan Bromborsky

unread,
Mar 8, 2016, 4:30:05 PM3/8/16
to sy...@googlegroups.com

James Milam

unread,
Mar 8, 2016, 9:12:54 PM3/8/16
to sympy
I have gone through the example in the linked thread and have been able to get snakeviz to create a profile when running pydy-code-gen/pydy_code_gen/model's generate_n_link_pendulum_on_cart_equations_of_motion() function for a 10 link system. I do not have any experience working in C++ so I would not be as much help on that front but I do have some experience with python multiprocessing. The GIL will affect the multithreading portions of the multiprocessing module but have less impact on the multiprocessing portion of the multiprocessing module. The multiprocessing portion will spawn new python processes and so each one will have its own GIL but they are capable of running independently. I know that some work has been done to improve multiprocessing in python 3 through and I do not know if multiprocessing vs. multithreading is a result of that work and would not apply to python 2.

Considering my lack of experience in C++ would continuing towards a project on increasing the efficiency of the python code or focus more on generalizing the equations of motion generators? Or perhaps the combination where I would create a generalized equation of motion generator and increase the efficiency of the python code as I go?

James Milam

unread,
Mar 13, 2016, 10:25:02 PM3/13/16
to sympy
I apologize for the previous post needing a scroll bar to the left. I honestly have no idea how I turned off word wrap. I just posted a rough draft for this project to wiki. Any general comments/revisions would be greatly appreciated, especially regarding the scope/timeline for the project. https://github.com/sympy/sympy/wiki/GSoC-2016-Application:-Base-Class-and-Increased-Efficiency-for-Equation-of-Motion-Generators

Thanks,
Brandon

Jason Moore

unread,
Mar 15, 2016, 7:10:39 PM3/15/16
to sy...@googlegroups.com
Or perhaps the combination where I would create a generalized equation of motion generator and increase the efficiency of the python code as I go?

That sounds really good to me.
On Tue, Mar 8, 2016 at 6:12 PM, James Milam <jmil...@gmail.com> wrote:
I have gone through the example in the linked thread and have been able to get snakeviz to create a profile when running pydy-code-gen/pydy_code_gen/model's generate_n_link_pendulum_on_cart_equations_of_motion() function for a 10 link system. I do not have any experience working in C++ so I would not be as much help on that front but I do have some experience with python multiprocessing. The GIL will affect the multithreading portions of the multiprocessing module but have less impact on the multiprocessing portion of the multiprocessing module. The multiprocessing portion will spawn new python processes and so each one will have its own GIL but they are capable of running independently. I know that some work has been done to improve multiprocessing in python 3 through and I do not know if multiprocessing vs. multithreading is a result of that work and would not apply to python 2.

Considering my lack of experience in C++ would continuing towards a project on increasing the efficiency of the python code or focus more on generalizing the equations of motion generators? Or perhaps the combination where I would create a generalized equation of motion generator and increase the efficiency of the python code as I go?

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.

James Milam

unread,
Mar 22, 2016, 9:40:58 AM3/22/16
to sympy
Hi Jason, 

I was looking at also producing a Newton-Euler method for equations of motion generation but I saw an edit you made on another proposal saying to focus on the base class and speed ups OR base class and Newton-Euler method so that the scope of the project is not too big. I was wondering which of the two would be considered of greater use and would be more desired by the sympy community.

Thanks

Jason Moore

unread,
Mar 22, 2016, 9:45:43 AM3/22/16
to sy...@googlegroups.com
James,

That proposal was proposing to add in the Newton Euler method and speed up all the existing methods, among other things. We can always add things if a person finishes early but I'd rather see proposals that promise less so that the scope is guaranteed to be finished.

I will comment on your proposal.

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.

Jason Moore

unread,
Mar 22, 2016, 11:26:48 AM3/22/16
to sy...@googlegroups.com
James,

I put some comments in your app. The timeline looks reasonable, but be careful about trying to do too much. The summer when LagrangesMethod was create took one student the whole summer to complete that with full tests and docs along with several convenience functions. This student didn't have python experience but had good dynamics experience, so maybe you can do more than that.

I would recommend improving your plans for the actual features that you want to add and the bugs you want to fix.

James Milam

unread,
Mar 23, 2016, 10:20:29 PM3/23/16
to sympy
Hi Jason,

I've updated the application and am planning on doing final revisions and submission tomorrow and was wondering if you or anyone else would be able to look at it and provide feedback one last time. 

Thank you for all of your assistance

Reply all
Reply to author
Forward
0 new messages