A Linux Guide to Book Scanning (& processing)


A Linux Guide to Book Scanning (& processing)

Quantum Harmonic Oscillator: Power series method in Maple


In the previous blog post What is Computational Physics (Science)?, I ended the post with the following figure

Graph of the probability distribution of the 100th state of the quantum
harmonic oscillator (generated using the power series method).

and stated that I might write a post on how to solve the Quantum harmonic oscillator numerically using the power series method (the other method being the ladder operator method [1]) and generate that figure. This post is just about that.

Ok. First I need to clear the cache with the restart command, import the PDEtools (to solve the pde SE) and Maplets[Elements] (necessary if you want to generate a maplet with a slider) packages.

with(PDEtools): #we need to use the dchange command later in the solution

Extraterrestrials & the Digital Universe -Von Neumann & Edward Teller


I’ve been reading George Dyson’s Turing’s Cathedral lately & today I read something interesting about intelligent life & computers from the age of John von Neumann & Edward Teller, which I’d like to share [1]:

Von Neumann rarely discussed extraterrestrial life or extraterrestrial intelligence; terrestrial life and intelligence were puzzling enough.

…”There is every reason to believe that any planet on which a large variety of molecules can reproduce by interconnected (or symbiotic) autocatalytic reactions, may see the formation of organisms with the same properties.” One of these properties, independent of the local conditions, might be the development of the Universal Machine.
Over long distances, it is expensive to transport structures, and in expensive to transmit sequences. Turing machines, which by definition are structures that can be encoded as sequences, are already propagating themselves, locally, at the speed of light.

…Those best able to survive the passage of time, adapt to changing environments, and migrate across interstellar distances will become the most widespread. A life form that assumes digital representation, for all or part of its life cycle, will be able to travel at the speed of light. As artificial intelligence pioneer Marvin Minsky observed on a visit to Soviet Armenia in 1970, “Instead of sending a picture of a cat, there is one area in which you can send the cat itself.” [p.290]

The host planet would have to not only build radio telescopes and be actively listening for coded sequences, but also grant computational resources to signals if and when they arrived. The SET@home network now links some five million terrestrial computers to a growing array of radio telescopes, delivering a collective 500 teraflops of fast Fourier transforms representing a cumulative two million years of processing time. Not a word (or even a picture) so far -as far as we know. [p.291]

In a discussion with Edward Teller, the authors quotes Teller:

 “…If there is life in the universe, the form of life that will prove to be most successful at propagating itself will be digital life; it will adopt a form that is independent of the local chemistry, and migrate from one place to another as an electromagnetic signal, as long as there’s a digital world -a civilization that has discovered the Universal Turing Machine- for it to colonize when it gets there. [p.292]

IPython: Python at your fingertips


To install the IPython notebook, do the following:

sudo apt-get install distribute ipython python-zmq python-tornado ipython-notebook
pip install numpy matplotlib #if you want to use the numpy extension & matplotlib plotting library
ipython notebook # launch the notebook from a terminal (will open in browser!)


Online Security: Rules to stay safe online


Some basic rules of thumb to use when online to increase your safety online, ordered in order of

  • General
    • Never open or reply to any email from an unknown. Consider it suspicious.
    • Never click a link given by a stranger or even by a friend if you’ve not asked for it.
  • Browser related
    • Disable redirects (links might redirect you to fake pages!)
    • Use HTTPS instead of plain HTTP
    • Block JavaScript & Java
    • Block Ads
    • Block 3rd parties in web pages (most of which are hidden)
    • Control cross-site requests
    • Erase internet history, private data, cookies
    • Erase Flash Local Shared Objects (LSO), also known as long-term Super-Cookies

Note: Pages might not load well enough with the above; you will often need to allow some services & parties, but at least its under your control!

  • Chatting
    • Follow the “General”
    • Use a good Instant Messenger
    • Use encryption

And remember, a computer is as smart as its user is & secure as cautious its user is!

Disclaimer: Please be warned that following the above rules increases your online security but it is by no means guaranteed to be completely safe! As a matter of fact, there’s nothing as being completely safe online!

Thanks for reading

last update: 2013-09-15

Useful Unix/Linux commands

$ indicates terminal command
# indicates a comment
Bold indicates “not installed by default”
$ lsusb     #list USB devices
$ lspci     #list all PCI devi
$ startx    #initialize an X session
$ more      #filter for paging through text one screenful at a time. (less gives more advanced).
$ less      #opposite of more; allows backward movement in the file as well as forward movement.
$ stty      #change and print terminal line settings
  $ stty size # prints terminal size

File commands

$ locate            #find files by name (for newbies I suggest the gui catfish -requires installation)
$ find              #search for files in a directory hierarchy
$ ls                #list directory contents
$ cd                #change directory
$ pwd               #print name of current/working directory
$ cp                #copy files and directories
$ rm                #remove files or directories
$ rmdir             #remove empty directories
$ file foo.format   #extracts info about file and what software it was written with; helpful in the case of having forgot which software was used to produce such a file

System info

$ uname
$ df                         #report file system disk space usage
                             #e.g; df or df /home
$ man                        #interface to the on-line reference manuals
$ free                       #Display amount of free and used memory in the system
                             #e.g; free -mt (m for MB & t for totals line)
$ uptime                     #tell how long the system has been running.
$ finger                     #user information lookup program
$ w                          #show who is logged on and what they are doing.
$ whoami                     #print effective userid
$ cat /proc/meminfo          #memory info
$ cat /proc/cpuinfo          #cpu info
$ lsb_release -a             #print (a: all ) distribution-specific information
$ last -x | grep shutdown    #show listing of last 10 logged in users; you can pipe this to the tail to read the last n instances.
                             #e.g; for 10 instances: last -x | grep shutdown | tail -n 10
$ last -x | grep reboot      #show listing of last logged in users
$ sudo shutdown -P hh:mm     #shutdown & poweroff (-P) @ hh:mm


$ uname
$ ps               #report a snapshot of the current processes.
$ top              #display Linux tasks
$ htop             #interactive process viewer based on top
$ watch            #execute a program periodically, showing output fullscreen
                   #e.g; watch -n 5 free -m
$ powertop         #program to analyze power consumption on Intel-based laptops
$ kill pid         #send a signal to a process
$ killall proc     #kill processes by name
$ pidof program    #find the process ID of a running program

Some useful terminal shortcuts

Ctrl+C #halt the current command
Ctrl+Z #pause command
$ fg #resume paused command in foreground bg resume paused command in background
Ctrl+D #logout of current session (similar to exit)
Ctrl+W #erase last word before cursor
Ctrl+U #erases the whole line
Ctrl+R #type to bring up a recent command
I hope this list turns out to be useful to you 🙂

Thanks for reading

last update: 2014-11-03

What is Computational Physics (Science)?


As a senior physics undergraduate I have come to believe that scientific computation must be part of the physics curriculum. It is true that physics students are required to study and master many topics, languages, techniques, and skills like mathematics, linguistics, & science communication, still I think that computational physics should be a major part of the curriculum. It is not logical to be in the age of supercomputers and the physics curriculum remain bound to pen and paper as it used to be before the advent of computers! I am not suggesting that physics should all be done on computers; absolutely not. The student must acquire the necessary theoretical and mathematical concepts and skills, besides the physics thinking, before delving in computational physics! What use would a computer have if its user doesn’t know what he wants to use it for? In other words, how would a physics student who hasn’t studied classical mechanics be able to solve a classical mechanics problem on a computer? He will surely not be able to do so, since he will not be able to appropriately instruct the computer due to his lack of conceptual physics and paper & pen problem solving skills. In short, “a computer is as dumb as its user is dump, and a computer is as smart as a smart user; the smarter and knowledgeable the user, the more productive and efficient the computer is”!

The computer is a little over 70 years old. The first computer, many articles & resources claim, is the “Electronic Numerical Integrator And Computer“, or ENIAC for short, which is not technically correct. Many other computers preceded ENIAC most of which were developed for military purposes (e.g; calculation of artillery, cryptoanalysis, etc…) and were analogue (or electro-mechanical) & programmed by punched cards. ENIAC was a room-sized computer that required several people to operate by turning on/off switches that made use of vacuum tubes the ancestor of the modern transistor.

One particularly interesting electromechanical machine (could be called a computer) was the “bombe” [1] which was [designed] by the mathematician Alan Turing to be used to crack the Enigma, the code used by the Nazi to encrypt messages.

Working rebuilt bombe at Bletchley Park [2].
Interior of the rebuilt bombe at Bletchley Park.
The bombe was in part successful in breaking the Enigma. Moreover, Alan Turing has impacted the modern day internet as well; everyone of us using the internet have definitely faced the “CAPTCHA” which are used to counter-bots & make sure the user is an actual human being & not a bot (from robot). CAPTCHA is an abbreviation for “Completely Automated Public Turing test to tell Computers and Humans Apart”. And yes, Turing in CAPTCHA is the same as Turing the mathematician of the 1940’s, though the original Turing test was a human against a machine test not the other way round!

Continue reading