Skip to main content

Computational physics

Specifically, a course on computational physics which I am taking this semester. Sorry if you were expecting something different or something broader! Either way, given that I have a course viva tomorrow for which I need to clean up my codes and get together my results, I thought that I'd talk about it today. As part of the course so far, we've simulated classical (say rutherford scattering) and quantum scattering, learnt the verlet and velocity verlet algorithms to simulate molecular dynamics, learnt the metropolis-hastings sampling method to implement markov chain monte carlo techniques to simulate said molecular systems. Coming to an end, we're learning the entropic sampling method to implement monte carlo and using said method to measure the free energy of systems. And eventually, we will be taught parallel programming as well but as I've written before, it's pretty easy to do parallel processing in python so I implemented a rudimentary version. You can check all of the codes here, using the online nbviewer.

I always heard about monte carlo techniques and I've wanted to learn it for a while now. One thing I've come to realize over these 3 months is that I learn best when someone introduces me to the topic, instead of me having to learn the ropes all on my own. I've had to pick up python this way and I now feel that it would've been much faster had I used it as part of a course with people I could've bugged for doubts. Also, it's dawning on my that almost everyone in grad school writes code (duh! it took me so long? STUPID!) and that if i wanted to be better at it than the rest, I needed to do more courses, learn more techniques and practice more. Well, I intend to do a couple more computational courses next semester so with a good amount of practice, I might be able to say that I'm a bit better than the rest, at computational physics. Hey, I have to be better at something! I wouldn't be able to live with myself otherwise! :D

PS - I should start noting down the time it takes for me to write one of these blog posts. It might be interesting to see trends like how long it takes for me to write an article against it's length and if the time it takes for me to write an article increases or decreases with time. Interesting...

Popular posts from this blog

Animation using GNUPlot

Animation using GNUPlotI've been trying to create an animation depicting a quasar spectrum moving across the 5 SDSS pass bands with respect to redshift. It is important to visualise what emission lines are moving in and out of bands to be able to understand the color-redshift plots and the changes in it.
I've tried doing this using the animate function in matplotlib, python but i wasn't able to make it work - meaning i worked on it for a couple of days and then i gave up, not having found solutions for my problems on the internet.
And then i came across this site, where the gunn-peterson trough and the lyman alpha forest have been depicted - in a beautiful manner. And this got me interested in using js and d3 to do the animations and make it dynamic - using sliders etc.
In the meanwhile, i thought i'd look up and see if there was a way to create animations in gnuplot and whoopdedoo, what do i find but nirvana!

In the image, you see 5 static curves and one dynam…

Pandas download statistics, PyPI and Google BigQuery - Daily downloads and downloads by latest version

Inspired by this blog post : https://langui.sh/2016/12/09/data-driven-decisions/, I wanted to play around with Google BigQuery myself. And the blog post is pretty awesome because it has sample queries. I mix and matched the examples mentioned on the blog post, intent on answering two questions - 
1. How many people download the Pandas library on a daily basis? Actually, if you think about it, it's more of a question of how many times was the pandas library downloaded in a single day, because the same person could've downloaded multiple times. Or a bot could've.
This was just a fun first query/question.
2. What is the adoption rate of different versions of the Pandas library? You might have come across similar graphs which show the adoption rate of various versions of Windows.
Answering this question is actually important because the developers should have an idea of what the most popular versions are, see whether or not users are adopting new features/changes they provide…

Adaptive step size Runge-Kutta method

I am still trying to implement an adaptive step size RK routine. So far, I've been able to implement the step-halving method but not the RK-Fehlberg. I am not able to figure out how to increase the step size after reducing it initially.

To give some background on the topic, Runge-Kutta methods are used to solve ordinary differential equations, of any order. For example, in a first order differential equation, it uses the derivative of the function to predict what the function value at the next step should be. Euler's method is a rudimentary implementation of RK. Adaptive step size RK is changing the step size depending on how fastly or slowly the function is changing. If a function is rapidly rising or falling, it is in a region that we should sample carefully and therefore, we reduce the step size and if the rate of change of the function is small, we can increase the step size. I've been able to implement a way to reduce the step size depending on the rate of change of …