A few weeks back I wrote a post on calculators, expressing my desire for something that was more than a push-button emulator, and less than a full programming language. Something where you just have a window where you can type 2.3*Msun*c**2, define short expressions for re-use, etc. Python seems to be the obvious thing but it has some annoying quirks; I also recommended Plaincalc. The comment stream was fascinating and very educational, with pointers to Wolfram Alpha, the Statusbar calculator for Firefox, and iCosmo, as well as some Python tutorial from Ross C.
I have been thinking about a similar post on graph plotters. While playing with these, I suddenly realised that the plotting package I use most often, gnuplot, does exactly whats needed ! Doh ! You can do calculations – eg print 18.3 * 27.6. You can define and use variables – eg a=pi/6, b=18.3, and then c=b**2*sin(1.3*a). You can define and use single expression functions – e.g. f1(a,b,x)=a*x**2+b*sin(x)/x; then with a and b already set you can calculate g=f1(a,b,2.3)/f1(a,b,3.2). Finally of course you can plot f1(a,b,x) – gnuplot assumes x is the variable and other variables are parameters. Then you can change the values of a and b and replot.
So now I have a file of physics and astro constants which is loaded by my .gnuplot initialisation file, so I can type 2.3*Msun*c**2. Next up, some standard functions, eg RBB(nu,T) = (2.*pi/c**2) * nu**3 / (exp(h*nu/(k*T)) – 1.).
So gnuplot is now my standard calculator, rather than Python interactive mode. The Python fans will now tell me that there is a Python version of gnuplot. Indeedy… but thats straying into the graph plotter shoot-out territory…. Watch this space.