Executable math

From OLPC
Revision as of 13:16, 30 January 2008 by Mokurai (talk | contribs) (Category)
Jump to: navigation, search

There are a number of free math programs available for Linux.

APL and J

The following examples are taken from Ken Iverson's language J, the latest version of APL, which is available at no charge for Linux, but without source code. The examples could be rendered in A+, which is available in Linux packages, but requires a special font. Iverson wrote books on Arithmetic, Algebra, and Calculus, all published by APL Press. There are other books in APL on probability, statistics, cryptanalysis, computer graphics, and computer design. Springer-Verlag published APL Programs for the Mathematics Classroom', which came out of the I-APL project to create free math software for schools. In the 1960s IBM loaned a 360 computer to a nearby school system for teaching math, starting in First Grade.

   NB. The J comment symbol is NB. 
   NB. The interpreter ignores anything from there to the end of the current line.
   1+2 NB. The interpreter indents to wait for input. Results of expressions are displayed with no indent.
3
   1-2 NB. Negative result
_1
   1%2 NB. Division
0.5
   2 * 3 + 5 NB. Right to left evaluation; no function priority
16
   2 * (3 + 5)
16
   (2 * 3) + 5 NB. Parentheses change order of evaluation
25
   1 2 3 + 2 NB. Add number to each element of vector
3 4 5
   a =. 3 9 7 NB. Assignment
   +/a NB. Sum
19
   #a NB. Number of items
3
   (+/a)%(#a) NB. Mean
6.333
   (+/ % #) a NB.(f g h) a is evaluated as (f a) g (h a)
6.333
   a * a
9 81 49
   +/ a * a
139
   a +/.* a NB. Vector inner product
139
   3 >. 2
3
   3 <. 2
2
   >. / a
9
   <. / a
3
   (>. / a) - <. / a
6
   range =. (>./) - (<./) NB. Function assignment
   range a
6

Maxima

A Free Software version of Macsyma.

Ed Borasky, 25 December 2007: Maxima runs just fine on the XO! In fact, I installed the wxMaxima GUI and that works too. The fonts are a tad big -- I haven't attempted to reconfigure them. Depending on which Maxima run time you pick, the whole thing can get as big as 40 MB of disk space, but I think it's worth it. I haven't found anything smaller that's as comprehensive.

Plus, you get a Lisp interpreter (GCL, CMUCL, Clisp or SBCL). GCL is the default, but I've heard that project is drifting into obscurity, as is CMUCL. So your choices really are between Clisp and SBCL. I picked SBCL, but it is the one that takes up the most disk space.