|
|
||
|---|---|---|
| cmd | ||
| internal/lib | ||
| lib | ||
| .gitignore | ||
| COPYING | ||
| README.md | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
README.md
mathtools
mathtools is a program for computing various mathematical results that would be tedious to compute by hand.
Why?
Obviously, libraries, software packages, and websites exist for these sort of calculations, but there are tradeoffs with any approach. Rather than needing to write a script, use a REPL, or load a webpage, this allows for an approach more like standard CLI utilities such as GNU factor.
Generally, I've opted to implement routines for problems that are best solved with algorithms, rather than formulas. For instance, the quadratic formula, while useful, is basically plug and chug, and thus isn't implemented here. On the other hand, determining whether a number is prime is a little more tedious to do by hand, so it's provided as a routine.
Available routines
Available routines include:
- convergents of a periodic continued fraction
- solving systems of linear congruences with the Chinese remainder theorem
- discrete logarithm
- greatest common divisor
- primality testing
- Jacobi symbol
- modular inverse
- modular square root
- multiplicative order
- integer partitions
- solving Pell equations
- primitive root modulo n
- area of a simple polygon from vertex coordinates
- sieves for totient function, divisor function, Mobius function, and more
- repetend of the continued fraction of a square root
- Stirling numbers
- summatory functions