# The smooth math search

March 6, 2006 at 6:34 PM by Dr. Drang

I’ve tried out several math programs, hoping to find one that’s both general enough to handle the variety of problems I need to solve and natural enough in its syntax that I don’t have to think about how to do the input for simple problems. I’m basically looking for a super calculator, something that I can use interactively and write simple programs for. Apart from the various Matlabish programs, I’ve looked into

- Lush: The parentheses don’t bother me, but prefix notation just doesn’t seem natural for math.
- R: Great for statistics, but too much notational fussiness for other matrix problems.
- Numerical Python: Always seems to getting forked and rebuilt; I’m afraid of choosing an orphaned version.
- Numerical Ruby: Not ready yet?
- PDL: I like Perl, and I have never had the disgust with its syntax that others seem to, but the PDL notation just doesn’t seem right.

I’m beginning to think that Octave is as close as I’m going to get to my ideal, and I should concentrate on learning it well. I don’t know that it’s better than the similar programs RLab, SciLab, or Yorick, but it’s what I’ve used the most and I haven’t seen a compelling reason to switch among this group. (In gathering the links for this post, I learned that SciLab has some form of sparse matrix support, which makes it worth looking at a little more closely.)

One thing Octave is lacking is a set of trig functions for dealing with angles given in degrees. The conversion isn’t difficult, of course, but it’s a pain to type all those `*pi/180`

s. I made a `.octaverc`

file with the following definitions to eliminate some of the extra typing. The new function names are simply the radian-based function names with a “d” appended to them.

```
function retval = sind(x)
retval=sin(x*pi/180)
endfunction
function retval = cosd(x)
retval=cos(x*pi/180)
endfunction
function retval = tand(x)
retval=tan(x*pi/180)
endfunction
function retval = secd(x)
retval=sec(x*pi/180)
endfunction
function retval = cscd(x)
retval=csc(x*pi/180)
endfunction
function retval = cotd(x)
retval=cot(x*pi/180)
endfunction
function retval = asind(x)
retval=asin(x)*180/pi
endfunction
function retval = acosd(x)
retval=acos(x)*180/pi
endfunction
function retval = atand(x)
retval=atan(x)*180/pi
endfunction
function retval = atan2d(x, y)
retval=atan2(x,y)*180/pi
endfunction
function retval = asecd(x)
retval=asec(x)*180/pi
endfunction
function retval = acscd(x)
retval=acsc(x)*180/pi
endfunction
function retval = acotd(x)
retval=acot(x)*180/pi
endfunction
```

Simple, but useful.