Here are some very useful extensions for bc – the unix command line calculator program. These files were created by Steffen Brinkmann for the Xbc Project and are distributed under GPL license.
- extensions.bc – defines useful functions such as sin, ln, log, etc
- scientific_constants.bc – defines many useful scientific constants
To use them simply specify them on the command line when you run bc:
bc extensions.bc scientific_constants.bc
If you want to use them all the time, it is probably a good idea to create an alias in your .bashrc:
alias bc='bc -l extensions.bc scientific_constants.bc'
Installation script – run this to install these extensions on your system and create an alias in your bashrc:
echo alias bc='bc -l .bc/extensions.bc .bc/scientific_constants.bc'