Monday, November 25, 2013

On education

...But perchance someone may say, "What is this? You, who have promised to give directions in regard to the education of free-born children, are now evidently disregarding the eduction of the poor children of the common people, and you acknowledge that you are offering your suggestions for the rich only." To these it is not difficult to make reply. My dearest wish would be that my scheme of education should be generally useful; but if some being needy in their private circumstances, shall be unable to avail themselves of my directions, let them lay the blame therefor upon fortune and not upon him who gives this counsel. Even the poor must endeavour, as well as they can, to provide the best education for their children, but, if that be impossible, then they must avail themselves of that which is within their means.

From The education of children which is attributed but almost certainly was not written by Plutarch.

Wednesday, October 30, 2013

Different kind of history

“It is in this respect that the present study will be found to differ most strongly from ‘history of ideas’ approaches, which often tend to avoid going in any depth into technical details. However, as this book will show, it is precisely through the technical details, which become most absorbing when seen in the light of their full significance, that the true electric current of discovery runs. If we do not follow the current closely, we shall not really understand what happens and why. To use another image: the technical details are like the hinges of a door opened on a new vista. The change in view they make possible seems out of all proportion comes from the fact that, like hinges, they are mounted on a secure support: successful mathematical description of observed phenomena. And we cannot understand why the door swings unless we see how the hinges work.”

Julian B. Barbour, The discovery of dynamics, vol. 1 (1989) p. 17.

Saturday, April 27, 2013

Remote kernel for Mathematica via home router

Let's say you are sitting at home, surfing internet via your wireless router, and suddenly feel the unexplained urge to run some Mathematica computations. You can not do that using your laptop: the urge is too powerful, it requires 16 parallel kernels. But you can do that using your workstation which is sitting at your office 10 miles away (it's raining outside).  “Remote kernel is a solutions”, you think.


So you open “Kernel Configuration Options” in your local copy of Mathematica and add a remote kernel with just basic options:

Machine Name: my.office.work.edu
Remote Login: killbull
Kernel Program: math

You type “2+2” in the Front End, enter ssh password and get, instead of “4”, the frustrating error message: 

The kernel New Kernel failed to connect to the front end. (Error = MLECONNECT). You should try running the kernel connection outside the front end.

Being a smart person you immediately realize the following:
  1. Remote kernel can’t talk to your local Front End since you have firewall running. You add exception for the remote workstation’s IP address right away.
  2. Since you use the router your IP is 192.168.1.10 and is not visible from the ourside world. You have to make a VPN connection to your office network to allow the remote kernel to talk to your local Front End. It’s done in no time.  
In order to figure out the host name assigned to your laptop you run in terminal:


$ math -mathlink -linkcreate -linkprotocol TCPIP
Link created on: 33234@129-3-222-111.vpn.uh.edu,23253@129-3-222-111.vpn.work.edu

So remote Mathematica’s kernel will happily communicate with 129-3-222-111.vpn.work.edu. Obviously, you can google "what is my IP" and it instead.

Now you return to Mathematica’s “Kernel Configuration Options” and edit your remote kernel's properties. You click  “Advanced Options” and instead of Mathematica’s default

`java` -jar `mathssh` killbull@my.office.work.edu math -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`" -LinkHost `ipaddress`

you enter

ssh  killbull@my.office.work.edu /home/killbull/install/bin/MathKernel -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`" -LinkHost `129-3-222-111.vpn.work.edu`

Here

- “ssh” is instead of “`java` -jar `mathssh`“ so that Mathematica will use regular OpenSSH to communicate. This will allow you to make use of your huge .ssh/config file.
- “/home/killbull/install/bin/MathKernel” instead of just “math” since your Mathematica binaries on the remove machine are not in the PATH.
- “129-3-222-111.vpn.work.edu” instead of “ipaddress” so that remote Kernel will know where to find you local Front End.

Now everything work’s, and you can start to satisfy your urge immediately.