Jasmin's Adventures with Julia
Comparison work in Julia |
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 |