I have read
all the hints about command line calculators, and I've tried just about all of them, including:
- Python
- awk
- bc
Unfortunately, none of these options had built-in functions like sin() or cos(), or constants like pi. For Python, in order to include the math library you have to type
from math import *. But then to get it to do the things you want (like adjusting precision), you have to be familiar with Python and/or you have to read documentation on the Python math library. The problem with
bc is that when you type
bc -l you only get six built-in functions, such as s(), c(), a(), which are sine, cosine, and arctangent respectively. You don't get any built-in constants.
There's a better way, but it requires a small download of a program called
wcalc. If you have
Fink installed, you can just type
fink install wcalc (or get the pre-compiled version via
sudo apt-get install wcalc. After you've installed
wcalc, on the command-line in Terminal, type
wcalc and you're set to go. The program provides you with a prompt and tells you "Enter an expression to evaluate, q to quit, or ? for help." It's pretty self-explanatory.
[
robg adds: The Fink version of
wcalc is 1.7. However, on the home page I linked above, you can download version 2.2.2 for Mac OS X, which also includes a GUI version.]