As some of you may know, the programming languages I use the most are C and Python. One reason for this is popularity - I want to learn something that will help me edit the programs I use. I also think it's good to know at least one compiled language and one interpreted language. Interpreted languages or "scripting languages" are more convenient in most respects but they take longer to run. I already knew Python would be slower than C but I wanted to see how much slower.
To make the above plot, I used C and Python codes to diagonalize an n by n matrix and kept track of their execution times. Once you get past the small matrices, the trend that begins to emerge is that Python is ~30 times slower than C.
As part of a summer internship, I got to put together several electronic components, and for the first time, use something more permanent than a breadboard. I found my first circuit very frustrating because my solder connections kept coming loose and I was told to make it as small as possible. But seriously... am I so used to learning about algebraic varieties and Feynman diagrams that I have become allergic to learning a real transferable skill?
The need for my first circuit arose because the photodiode that we used to measure the power in various lasers had a proportionality constant that was too small. For every Watt of power, the diode was calibrated to put only across two pins. We wanted to amplify this to a larger value. The component typically used for these applications that you can buy off the shelf is the operational amplifier.
As those of you who read my third most recent post will know, I recently became excited about methods for predicting the spread of diseases mathematically. When I learned about compartmental models, I began searching for tips on how they could best be applied to real data. I stumbled upon a solution on Abraham Flaxman's blog, Healthy Algorithms.
In Abraham's post, he presents some code that will estimate the parameters in a dynamical system using Bayesian Inference - the most elegant thing to come out of statistics since the Central Limit Theorem. Also present is an exercise challenging the reader to estimate the parameters of a 1967 smallpox outbreak in Nigeria.
If you want to do this exercise without a spoiler then stop! Otherwise, keep reading and I will tell you how I approached the problem while making some random remarks on the strengths and weaknesses of this particular fitting routine.
In a recent post, we used trigonometry to derive the length of a day on the Earth as a function of the observer's latitude and the time of year. As promised, I want to continue modelling the Earth's orbit to see what it can tell us about temperature. The simplest explanation for the seasonal variation of temperature comes from the concept of solar flux. To see what this means, think about taking a ray of sunlight shining on the Earth and decomposing it into two components - one parallel to the Earth's surface and one perpendicular. Most of the sunlight going into the ground means this location will be hot, whereas most of the sunlight going along the ground means this location will be cold. The temperature due to direct sunlight is therefore proportional to the cosine of the angle between the ray and the outward normal to the Earth. To actually solve for a temperature, we would have to multiply the intensity of the light by and integrate this over a region of interest. Our main concern will be solving for , allowing us to express the temperature at one time relative to the temperature at another time without knowing the absolute intensity.
This site is under construction so don't judge me! Actually judge me all you want because a good site is always under construction. This site will contain many of my ramblings like pointing out chiasmus and if I put a decent amount of work into it, it might just have a small effect on someone's life!
Two and a half years ago, when I read the research interests of my statistics prof, I noticed that he had become interested in analyzing epidemiological models. Now, I might finally understand what he was talking about.
If we let S be the population of individuals who are susceptible to the disease, I be the population infected with it and R the population that has recovered, it is not too big a stretch to say that this plot appears to follow the progression of a non-lethal disease. Only a small number of people have the disease at the beginning, but this number grows because the disease is contagious. People who have recovered are immune to further infection meaning that the epidemic eventually dies out.
In my quest to watch a sunrise recently, I had to search the web to find out the time before which I needed to get up. Predicting the sunrise is something that I had pondered before. I'm sure numerical simulations are more accurate, but I began deriving a simple formula. Everyone knows the gist of why the Sun rises and sets and why this experience depends on your location on the globe. The answer is that it all depends on the tilt of the Earth's axis.
The Earth's axis of rotation makes a certain angle with the normal to the plane in which it orbits. This angle of inclination is . It is not hard to picture how this affects the seasons and why the tropics are offset from the equator by as well. I found it much harder to visualize the effect that the inclination has on the length of a day and most people I've talked to simply take it on faith that the Arctic and Antarctic circles are at latitude.
So now is our chance to overcome this hurdle. Together, you and I will figure out how to calculate the length of a day as a function of time for all latitudes. Hint: it is not a smooth function!
I'm finding it hard to believe that it has already been three weeks since I graduated from Queen's. My favourite part of the ceremony by far, was the speech by Emeritus Professor of physics, William McLatchie. This is not just because he mentioned a former student of his, Ted Hsu, the only politician who has ever made me feel thrilled about voting. His speech was unconventional by many standards.
First off, I would expect many graduation speeches to be congratulatory in nature. His was far from it - in fact he said that "mathematics acts as a diode." A much debated claim is that it is easier for the mathematically inclined to follow non-mathematical pursuits than it is for others to do the reverse. But his point was that PhDs who spend their days filling chalk boards with Greek letters - despite their desire to treat non-academics as equals - are regarded by the public as an out-of-touch, nerdy elite. The number of graduands who were on the path to receive a PhD in a quantitative science was rather high, so he felt compelled to tell us what may be a sad truth - that the degrees we would be getting would stigmatize us for the rest of our lives.
Maybe when I have a PhD, no one will want to believe the things I blog about. They might think I'm corrupt enough to put my research before the good of the world. When I try to defend my arguments, they might accuse me of using my academic super-powers to confuse and intimidate. Before that happens, there's something very important that I should mention to you. Even though I am known as quite a stubborn person, I can think of three major topics about which science has convinced me to change my mind:
I want to talk about the last one.
I've been remembering a lot of my dreams this month and in the spirit of full disclosure, I will tell you about them in all their random details! But first some fun facts. Humans dream during REM sleep, named after its "rapid eye movement", the stage of sleep most closely resembling wakeful neural activity. Various theories have been proposed for the regenerative functionality of REM sleep. Indeed, sleep deprived individuals and people trying out polyphasic sleep get less REM sleep, as the body favours the deeper stages in those circumstances. The image below, called a hypnogram, shows how the stages normally occur.
There are four or five cycles of REM sleep and they last for longer and longer amounts of time until the person wakes up. Movement of the eyes is presumably related to the fact that someone in a dream state feels mentally alert. I suppose the reason for the entire body not moving is the protection mechanism you hear about - where the body is physiologically immobilized during sleep. Even though this is supposed to wear off quickly upon regaining consciousness, some people report "glitches" where they wake up in total paralysis for several minutes. This has never happened to me but I think it would be really cool!
About ten years ago, when I first developed an obsession with browsing the web and an obsession with the number (some of you know it as ) I discovered Near A Raven and gasped at the ingenuity of it. This type of poem is called a piem and many of them have been made. The idea is simple - set up the poem so that the number of letters in each word is equal to the corresponding digit of the decimal expansion of Pi. The first word should have 3 letters, the second should have 1, the third should have 4 and so on. Put it all together and you have 3.14159265358979...
When I learned about Euler's number in high school, my mind was made up. I simply had to make a similar poem for . Like Near A Raven this has the advantage of being a faithful retelling of The Raven by Edgar Allan Poe with the same rhyme scheme. Even though I had to use some archaic words to make the poem rhyme, I am happy that I was able to consistently put the word "nevermore" at the end of each stanza. Hope you like it!