Learntofish's Blog

A blog about math, physics and computer science

Archive for January, 2012

How I learned to code

Posted by Ed on January 24, 2012

Read this very interesting story by James Somers in which he describes how Projecteuler helped him to finally learn programming. I wrote about Projecteuler earlier here.

My first program was on a Vtech laptop for kids. It had a BASIC interpreter. The code required you to specify the lines (yes, good old times) and use the goto command to write loops.


Posted in computer science | Tagged: , | Leave a Comment »

The sound of hydrogen

Posted by Ed on January 20, 2012

Henry Reich has a series of videos on physics and mathematics each lasting for a minute on his channel minutephysics. He explains topics by using handdrawn pictures and makes them look like an animation. Here are a couple of his excellent videos (among them one that explains how to create the sound of hydrogen):

Posted in mathematics, physics | Tagged: , | Leave a Comment »

TeXworks: a user friendly LaTeX editor

Posted by Ed on January 16, 2012

TeXworks is a LaTeX editor developed by Jonathan Kew. Jonathan gave a talk on his editor: TeXworks for newcomers-and what’s new for old hands. He designed it with the goal to keep the interface simple, and to make it easier for beginners with getting started. You can watch the talk below (be sure to watch it in 480p):

I am very impressed by the features:
– Use “CTRL+MouseClick” in the .tex file to see where the corresponding output in the PDF is. Conversely, you can use “CTRL+MouseClick” on the PDF to see where this output is generated in the .tex file.
– Auto completion via “TAB”. For example type “\sec” and TAB and it will complete it to “\section”
– A spell checker that ignores the LaTeX code: Go to Edit -> Spelling -> English
Note: If the option of choosing a language is missing, you have to install it. Check out the description here and here.
– LaTeX Error Hook: If you press the green button to create your PDF but you have errors in the .tex file, the green button will turn red.
Just click on the red button and a tab that only shows the errors will appear.

I discovered TeXworks after installing MiKTeX on Windows. MiKTeX is the LaTeX version for Windows. To install it proceed as follows:
1. Go to http://miktex.org/
2. On the left hand side click on “Download MiKTeX 2.9”. Choose for example “Basic MiKTeX 2.9 Installer” and start the download.
3. Install MiKTeX after the download. When it asks “Download packages on the fly” choose “Yes”.
4. After the installation has finished go to: Start -> All programs -> MiKTeX 2.9 -> TeXworks

If you already have MiKTeX but not TeXworks you can download TeXworks here: http://www.tug.org/texworks/

Before you start I recommend these settings for TeXworks:
– Activate the Syntax Highlighting by clicking on: Format -> Syntax Coloring -> LaTeX
– Show the line numbers by clicking on: Format -> Line Numbers
Change the font size: Go to Edit -> Preferences -> Editor (and set the font size e.g. to 12 pt)

LaTeX tutorial
If you are completely new to LaTeX I recommend these documents with an emphasis on math symbols:
Getting Started with LaTeX, By David R. Wilkins
ArtOfProblemSolving LaTeX tutorial (it includes a tutorial on TexnicCenter, another LaTeX editor, but you can ignore that part)

Posted in computer science | Tagged: , , | Leave a Comment »

Introduction to Markov Chains

Posted by Ed on January 15, 2012

In the following I will give an easy example on Markov Chains. I will assume that you know how to multiply two matrices.

Suppose today it’s Monday and you want to celebrate your birthday on Wednesday with an outdoor party. Of course, you are interested in the weather and you find this data:

If sunny today, then tommorow:
                   80% probability for sunny
                   20% probability for rainy

If rainy today, then tomorrow:
                   60% probability for sunny
                   40% probability for rainy

This data could for example have been collected during summer. Note that the weather tomorrow only depends on the weather from today, so e.g. it does not matter what the weather was a week ago. So today on Monday, you go outside and see that it is a rainy day. Therefore, the probability that it will be sunny tomorrow is 60%. The problem is that your birthday is not tomorrow but in two days on Wednesday. What is the probability then?

A good idea is to visualize the situation as a graph:

These are the ways to Read the rest of this entry »

Posted in mathematics | Tagged: , | Leave a Comment »

Great lectures in honor of Feynman

Posted by Ed on January 14, 2012

Caltech organized an event called TedxCaltech in honor of Richard Feynman. They invited speakers to talk about the person ‘Feynman’ and his work. Among them are Leonard Susskind, Michelle Feynman, John Preskill and many more. The talks are excellent.


The complete list of talks can be found here: TedxCaltech: Feynman’s Vision, the next 50 years

Posted in physics | Tagged: , , , | Leave a Comment »

Call by Object Reference (Call by Sharing)

Posted by Ed on January 9, 2012

In the following I want to talk about Call by Object Reference also known as Call by Sharing. I will use Python to illustrate the concept.

1. Strange behavior?

Let’s have a look at the following Python code:

def changeList1(x):

def changeList2(x):
    x = [41,42]

Save the code in a file callBySharing.py and run it in Read the rest of this entry »

Posted in computer science | Tagged: , , | 1 Comment »

More on Bell’s Theorem

Posted by Ed on January 6, 2012

In a previous post I shared some links with easy explanations on Bell’s theorem. Here, I want to continue although the explanations are more technical and require more knowledge:

11) Nonlocal correlations between the Canary Islands
This is an excellent blogpost on the blog BackReaction. It discusses the role of nonlocality in Bell’s theorem, in particular the locality loophole and the freedom-of-choice loophole.
Prerequisite: Understanding of light cones. Here are some practice questions on light cones.

12) Is the moon there when nobody looks? Reality and the quantum theory
This is a very intuitive article by David Mermin. He introduces machines that have 3 settings and two lamps (red and green) and shows that assigning 3 “real” properties to particles results in a contradiction.

13) Spooky Actions At A Distance?: Oppenheimer Lecture
A lecture by David Mermin on EPR and Bell’s theorem. Here, he uses three entangled particles (see Greenberger–Horne–Zeilinger state) instead of two. I recommend watching this lecture after you have read 12).

14) Bertlmann’s socks and the nature of reality
by John Stewart Bell
Here, John Bell derives the d’Espagnat inequality by considering socks that may or may not survive one thousand washing cycles at 45°C, 90°C and 90°C.

The d’Espagnat inequality is: N(A,notB)+N(B,notC)≥N(A,notC)
Bell mentions that this is trivial: Each member in N(A,notC) on the right hand side either doesn’t have property B and therefore is in N(A,notB) or has property B and therefore is in N(B,notC). Thus, the left hand side cannot be less than the right hand side, in other words the left hand side is greater or equal than the right hand side.
Note: When you read the document don’t wonder about the figures. They are not missing but shown in the end.
By the way, Reinhold Bertlmann was a colleague of John Bell at CERN. He is a professor now and still seems to wear differently coloured socks.
Bell’s original paper (see DrChinese’s site) becomes much more understandable with this document.

15) Part 1 – From Bell’s Inequalities to Entangled Qubits: A New Quantum Age?
This is a talk by Alain Aspect who conducted some experiments on Bell’s theorem. There are five parts.

16) Hidden variable – Derivation of line
In his talk Alain Aspect shows that one can construct a hidden variable theory that predicts a line for the expectation value. An easy to follow derivation can be found in Quantum theory: concepts and methods by Asher Peres on page 161-162.

Posted in physics | Tagged: , | Leave a Comment »