Jasmin's Adventures with Julia

Comparison work in Julia
In a previous post called 'The story so far...' I talk about my project up to the halfway point of my time at MIT. As I enter my final week here I'm beginning to think about wrapping up my work and spending the small amount of remaining time here exploring Boston... making now the perfect time to talk about the second half of my project.

My last post left with me attempting to prove that my solution to a Stochastic Differential Equation was correct with MATLAB. Apparently using MATLAB to code in a Julia lab, where I have been working these past 6 weeks, is frowned upon so I was advised to give Julia ago. Not only does Julia have special packages made for help with Stochastic Differential Equations but it is designed to solve such problems quickly. Therefore after a few days coming to grips with a new language, I was able to conclude with the help of Julia that the solution to the problem I had worked on for the previous week was incorrect. As the problem was two dimensional, Julia was able to show me a clear 3-D plot to represent my problem, in addition to this I was able to observe some variation in the correct solutions I was producing which wasn't being shown in my MATLAB method. I also began to realise my method of comparing one numerical solution of an SDE to a calculated solution is not the most accurate approach. I reverted to plotting the mean and interquartile range of 1000 numerical solutions for the most conclusive understanding of my solution.  As you can see from my chart, the lines representing my true solution do lie completely in the range of the SDE's, however ideally a solution would not leave the 50% interquartile range of solutions as often as my result does. I had to return to the drawing board for solving my equation.

So what went wrong initially?  Much like in differential equations, many problems cannot be solved explicitly in a simple way and mostly need to be solved analytically. There are tricks that can be used in order to simplify problems and I used a multi-dimensional version of Ito's formula, used as a sort of transformation which ended up not being as useful as I first hoped it would be. When reading up the second time I found a formula for linear SDE's that I had avoided earlier due to its undesirable form, at this stage I had learned that any solution I could find would be a good one and so I ran with it and found my answer. This time as I knew the formula was as direct a method I could ever get I didn't need to check my work. My next problem was set to be looking into an estimation of parameters of SDE's by using data however this started in a week where my lab was empty due to a Julia conference (see PhD Speed Date) so I couldn't ask too many questions in order to get started. Here I was introduced to an idea for a project to use during my remaining time by a PhD. They were studying the knots formed by protein in cells and in order to do this they built a simulation in MATLAB, they then suggested I try building this in Julia. I liked the idea of this because eventually, I could relate the project back to SDE's by adding random forces in fluids. I was really excited about working on this because I had never built a simulation for anything before. I had to buckle down and work on my physics quite a bit, in fact, I spent a whole week working on my understanding on twist forces for my model before discovering it was only really a secondary problem. During that particular week, I discovered a bit about something called parallel transport, a technique used to figure out the change in direction of a 3-D path. We used this idea in order to have a fixed path called the bishop frame that would be traversed if there was no rotation. The angle of rotation from this frame to the actual path's frame is then defined as the twist which is simply an angle.
My Slightly Odd Simulation


For the simulation, the rod was broken down into nodes connected by elastic firm rods. I could then define rotation and bend for each rod for ease of calculation. The bending force of the rod at a node could be calculated by figuring out the angle between two rods attached to said nodes. This force can then be used to calculate the velocity of each node. My initial simulations ended up being a mess. This was because I needed to consider the weight of the rod, the damping constant, the bending modulus and I had forgotten the constraints to stop the rod from stretching to 100 times its original length. After adding a regulation which causes the rods to act a bit more like springs my simulation began to behave a lot more. Which is where I am now! As my project comes to an end I have a chance to think about what I want to do with all the things I have learnt from my time here. A major point that stood out from me was when a student here said how motivated they feel to work on their project because it is a problem that they really care about, this was supported by my supervisor telling me that a research job shouldn't feel like a job. One of my aspirations for this project was to have a flavour of whether or not I would want to stay in academia. To that, all I can say is I am unsure. Until I reach my third year and I feel like I have a solid idea that I am passionate about to research in my master's project  I won't be able to know. I can say that I have enjoyed the learning process here, much like my undergraduate experience I had to struggle in order to understand or solve problems however the enjoyment of finally understanding or having a solution overshadows all the previous struggling. Between being introduced to a new language, learning about a fascinating part of mathematics and working in a lab among hard-working PhD's I have had an invaluable and enjoyable experience.