This is a guest post by Aravind Baskaran, whose home ground is browsers & smartphones. He loves tinkering and tweaking with technology. He currently works at CloudPact building the Mowbly platform.
Spending time with Julia made me realize that rabbits and foxes don’t like co-existing but still do it for the sake of world peace. She tinkers with numbers, predicts future and exaggerates the bad when I go wrong with my numbers. All this comes to her naturally. Yup, Julia is no ordinary gal. Julia is quick, easy-to-handle and a delight to anyone who gets to know her. Puns aside, Julia is a kinda open-source MATLAB. I would be lying if I say I knew what that meant. This interest was born out of lonely nights on the internet, surfing to unknown foreign sites and suddenly I found Julia. In the latest edition of Devthon at Bangalore, I spent some time with Julia.
I know almost nothing about MATLAB, R, etc. all of them statistical calculation languages out there(except for their names). So the goal — to build visualizations with simulated data for a real world situation. Amarnath, with his stickered linux, joined me on this “quest” to know Julia.
So we started with a “Hello Julia”, and quickly worked up to a base, trying out some tutorials. Fine, hunky dory. Everything works. So got huge set of numbers and tables. Now onto the visualizations! Except I was using a Mac. And Julia has some issues with Macs. I tinkered and toiled through the night convincing Julia. But nope, there was something wrong with her packaging. The next morning, Amarnath comes and shows me that Julia’s packages has no issues with Linux. And so I scped/sshed (whatever I did) with his laptop. Phew! Talk about touchy. Anyway, with a bit of Daft Punk, we made progress with being able to build sample visualizations in the morning.
Now, the core, the real world situation. Two cases — Rabbit Vs Fox and the Apollo 13 spaceflight mission. Let me divulge,
Rabbit vs Fox
(Image Source: http://www.memecenter.com/fun/933051/fox-rabbit)
Premise: Foxes eat rabbits. This is a dynamic system. The number of rabbits grow at a particular birth rate. The number of foxes grow at a rate dependent on the number of rabbits. The number of rabbits decreases at a rate dependent on the number of foxes. The number of foxes decreases at a particular death rate.
Variables: The probability that a fox meets a rabbit and the probability that the rabbit will become lunch in that encounter. The growth rate of rabbits and the death rate of foxes.
Now put the premise and variables in a mathematical equation and run it over, say 100 units of time(unit here could be a year), we get an awesome set of numbers.
Time Rabbits Foxes
0.75 32.13 21.87
1.0 31.52 26.70
1.25 29.41 32.46
Plotting them together and then again each separately, but didn’t make much sense. Red — Rabbit, Blue — fox
The data obtained had to be normalized so that we get a proper understanding of the rates rather than just the numbers. The results are below in the figure. Red — Rabbit, Blue — fox
This is an awesome demand-supply relation. Each time the peak increased exponentially, before the numbers started collapsing again. The durations of lulls in between also increased. This was exciting. Just imagine how the dot com bubble, economic recessions, etc could fit into this mathematical model! A stock market simulation could be run with properly parameterizing the variables. Thrilled!
Apollo 13 spaceflight
Apollo 13 needs to come back to the earth since mission critical systems started to fail. So “Houston, we have a problem.”
Premise: Apollo 13 is on the moon’s orbit. The moon pulls it, the earth pulls it. The module has thrusters. The thrusters need to be fired to the escape velocity of the moon and push towards earth’s pull.
Variables: The amount of acceleration from the thrusters. Followed up with vector equations of the forces in play, the acceleration could be adjusted to predict the flight path of Apollo 13. We ran a few simulations based on assumed acceleration(A) and the results.
A = 10, A = 12, A = 15, A = 100, A = -100.
From the graphs, we could safely say that the acceleration chosen must have been around 10, because doesn’t look they would have made it back for any of the other values
Challenge completed! Building math models to parametrize situations and simulating them, probably even analyze them, who knows what the future holds. Julia, you are one of a kind!
Thanks to Devthon, for enabling collaboration of minds and ideas. I’ve been part of both the editions till now, and I have to say, it has been fun! Here, creative juices mix in a way that you actually have fun and oh yes, how can one forget the excellent Julia puns.
Join in the innovation conversation on the forum (https://groups.google.com/forum/#!forum/devthon). There are many more interesting discussions you can be part of.
Originally Posted on July 03, 2013