Saturday 22 June 2013

GSoC: Week 1

Hmm. Week 1 of GSoC ends today. Its been a bit of a confused week, with most of my time spent thinking and  trying to determine how I am going to code the initialization of reference frames in the new mechanics core. Its going to be a little dense, with all the motion parameters being checked, analysed and stored, and the constraint of immutability making things a little difficult, implementation-wise. But I guess its better to make the classes immutable to gel well with the rest of SymPy, as the whole point of this part of my GSoC work would be to make sympy.physics.mechanics seem 'friendlier' to the rest of the codebase.

What was gained? Well, I did finish (today) determining how exactly I am going to go the whole initialization procedure, after a lot of brain-racking (its quite true when they say that programmers do most of their thinking not at their desk, but while doing things like eating and showering :-) ). A lot of math was involved, along with considerable thinking given to the exact implementation details. What did I learn? - Always plan out what you are going to implement, on paper, before you start typing code(especially if math is involved). Taking time and understanding what you are going to do, and then doing it, is much better than constantly changing your code as you keep finding faults. Anyways, I did finish coding the rough API and some elementary functions like those of time derivatives, relative motion etc., but all this will be useful only once I finish the __init__ method.

One good thing we decided to do was to code helper functions in the a separate file in the core to calculate motion parameters given differential equations and boundary conditions- using SymPy's integration and equation-solving functions, ofcourse. I proposed this way of doing things since having this in the reference frame code would be confusing and chaotic, not to mention unnecessary. At the same time, a user would want to create a new frame instance based on a velocity vector and initial position boundary values-or something on those lines. So this we felt was a good middle ground to enable both. This is going to take time, but I guess having a good foundation is always good.

In terms of code and API, I will have something concrete in my PR by the end of this week. Will try and show a mock SymPy session in my next post :-). Anyways, thats all for now. I wont be able to do much tomorrow, since I have to travel to a relative's place for lunch..though I guess I could work at night for an hour or two. A long week ahead, wish me luck :-D

No comments: