awk.

No, seriously. I even have a` bin/c `script I use all the time,

`#!/bin/sh`

exec awk 'function choose(n, k) { choose_r = 1; for (choose_i = 1; choose_i <= k; choose_i++) choose_r *= (n - choose_i + 1) / choose_i; return choose_r }

function asin(arg) { return atan2(arg, sqrt(1.0 - arg*arg)) }

function acos(arg) { return atan2(sqrt(1.0 - arg*arg), arg) }

function atan(arg) { return atan2(arg, 1.0) }

function tan(arg) { return sin(arg)/cos(arg) }

function abs(arg) { if (arg < 0.0) return -arg; if (arg > 0.0) return arg; return 0 }

function fact(n) { fact_r = 1; for (fact_i = 1; fact_i <= n; fact_i++) fact_r *= fact_i; return fact_r }

function log10(x) { return log(x)/log(10) }

function log2(x) { return log(x)/log(2) }

BEGIN { Pi = PI = pi = 3.14159265358979323846 ; deg = pi/180 ; s = sprintf("%.16f", ('"$*"')); sub(/00*$/, "", s); sub(/\.$/, "", s); printf "%s\n", s }'

and for anything iterative, I often reach for` awk 'BEGIN { ... }' `. I also have a few dozen manipulator scripts and programs doing range math, IEEE-754 conversions, et cetera.

For symbolic math, I use Maple or SageMath.