I haven’t talked about many command-line calculators. I suppose that means jumping straight to bc might be a bit heavy-handed.
This is not my first run-in with bc; I mentioned it years ago as a solution for calculating at the prompt. I think I said you could balance your checkbook with it. 🙄
I use it from time to time, when I need to find out what 8 gigabytes is in terms of kilobytes, or something odd like that. It’s rare that I put it through its paces.
Which is unfortunate, because bc is a powerful little program. What do I mean by that?
Well, can your pocket calculator estimate pi to the 5000th digit? Can your office calculator? Can Google?
bc can. Start it with bc -l
, and try this:
scale=5000; 4*a(1)
After a minute (or two or three or ten 😉 ) you should have an answer. And it will fill your screen.
I haven’t been appreciative enough of this little program (I could say that about a lot of things), and considering how easy it is to use and how flexible it is, that’s a shame.
And I’m tempted to put it all down on “paper,” but someone else already did a better job. If you want a proper introduction on how to use bc, that’s the place to go.
And besides: I have hundreds more applications to look at. 😦 Moving on. …
You can do wonders with Python an mpmath (python-mpmath package on Debian repos)
#!/usr/bin/python
import mpmath #Load mpmath library
mpmath.mp.dps = 100 #Decimal precision
print mpmath.pi #Print pi constant defined on mpmath libray with the previous precision.
Also, try yo learn Python, at least a little bit. I wrote a program with 5 lines with Python and Json which it prints a list of
playlist URL’s so you can pipe them to wget and finally, play them with Mocp or Mplayer:
cat getpls.py
import urllib2
import json
f=urllib2.urlopen(“http://listen.sky.fm/public3/”)
data = json.load(f)
a = []
for i in range(0,len(data)):
print(data[i][“playlist”])
##EOF
ander@darkstar:~$ python getpls.py | grep jazz | wget -c
Sorry, the formatting of WordPress played badly with the strict Python tabs inside a function. Here is the correct script:
http://pastebin.com/raw.php?i=3xSh6AGb
Pingback: calc: You knew this was coming | Inconsolation
Pingback: ised: Compact power for calculating | Inconsolation
Pingback: qalc: qalculate!’s text only version | Inconsolation
Pingback: reptyr: Pull the rug out from under your tty | Inconsolation
Pingback: screenify: A tetchy little tool | Inconsolation
Pingback: wcalc: A calculator with a conventional appeal | Inconsolation
Pingback: e: Like a diamond bullet | Inconsolation
Pingback: c, calcc and calccmd: Three small calculators | Inconsolation
Pingback: c, calcc and calccmd: Three small calculators | Linux Admins