This library currently contains the following operations:
- sum(list/l)
- squaresum(list/l)
- mean(list/l)
- variance(list/l)
- standarddev(list/l)
- factorial(n)
- nPr(n,r)
- nCr(n,r)
- integer(n)
- sign(n)
- deg2rad(n)
- rad2deg(n)
- pyth(a,b)
- arcpyth(a,c)
- triarea(a,b,C)
- tan(n)
- cot(n)
- sec(n)
- csc(n)
- arctan(n)
- arccot(n)
- arcsec(n)
- arccsc(n)
- arctan2(x,y)
I've actually found in my ProcLib tests that sign is (oddly enough) faster this way:
rather than using a ternary operator or a series of conditionals.
For converting to and from radians and degrees, you can keep a constant (180 * pi). For deg2rad, you multiply by (180 * pi), while for rad2deg, you divide by (180 * pi), so you might as well save the constant term.
Your integer() function uses a ternary operator, but == already returns 0 or 1.
I heard the ** operator is relatively inefficient in the case of x**2. Using x*x is apparently better, they say. You even do this in your arctan() and arccot().
Also (off the topic of optimization), Pythagorean's theorem works for any number of dimensions.