To Solve or to Simulate ?

No industry in Human history ever had a growth like the Semi-conductor industry. I mean, not long ago were we holding onto huge bricks for cell-phones and look at us now! Our modern calculators have more computing power than some early satellites like Apollo or Sputnik. This played a far more important role in science. This offered us a route of escape, that we were more than happy to grab and meep meep away like the Road-runner.

Just imagine, you are a physicist, who is trying to make sense out of this complicated mess of equations. But you can’t seem to do so, because Mathematicians haven’t discovered the way to solve the equation completely (or show it has a solution !). Now, the successors of ENIAC come along and say to you, “Hold my beer” and grateful are we.

Simulations are very crucial. They help us picture the solution to your problem, confirming or denying the claims you had in your mind. With the advent of Machine Learning and Neural network, my oh my, the horizon of hope and new possibilities, isn’t that exciting !

Without ML, we won’t even be able to decrypt the information from millions of particles emitted after collisions in LHC, CERN or those awkward energy levels of material science and lasers. So, all that said, How do I get me some of dem’ goodies ?

Unlike the CS students, we don’t need all that much of what they are offering. We can afford to start simple. When I was set on learning a language, what I did first was to google “Simple programming exercises for Noobies” and even that became boring after a few exercises.

As a student of Physics, I think all of us need to learn programming. Do you think you can beat a 60 year old Russian master in Integration tables of Gradshteyn and Ryzhik ? Maybe you will have a chance of beating him in solving integrations in MATLAB.

As a physicist, it will undoubtedly be boring for us to make patterns using * or find anagram or make a dictionary of a word. We are imaginative creatures full of youthful vigour. What we can do that will be any less boring and inventive would be to code simple physical situations in a language of your choice. My first attempt was to model diffusion of a single atom in a medium using python. I had some knowledge of diffusion and knew that it can be implemented using the Random walk model. In second step, I looked up the way to solve ODE in python and saw if I could match my raw-simulation results to the one the equation provided. Before I knew it, I was coding up Ising 2D spin lattice systems.

Guaranteed, I didn’t know a squat about the packages and modules, I would need but make no mistake, the simulation was something physical and Physics, I knew. Programming is not about syntax, it is about the flow of logic. When I decided on the logic, I googled and stack-exchanged all things I needed. Need a function to make a random choice between given set choices, googled “random choice maker functions”.

This gave me a lot of confidence and with confidence, I could hope to scale higher heights. Of course, your code is not going to be data efficient, but you can learn to pick it up, you can learn to optimize the number of steps needed to complete the program. At one point you will come to understand simple and obvious things like why O(log n) is better than O(n) etc. Then, if you’re interested more, thee shall venture into the deepest of seas without fear in thy heart.

So, my advice is, start simple but start with physical. Don’t try to start with reversing a linked list or Class vs Structure arguments. They sound plain boring already and we are not going to make a database of bank employees and their salaries.

Leave a comment