calc
Calculator
About
A commandline tool to calculate integrals/derivatives (and maybe more later) of mathematical expressions. For now, the expressions can only have one variable in them (derivatives always differentiate with respect to X, as do integrals integrate).
Made in school on a Chromebook using Godbolt.
Usage
Integration
calc "x^2 + 3*x + 5" i midpoint 0 5 4
^- expression ^ ^ ^ ^ ^- # of parts
^ ^ ^ ^- high
^ ^ ^- low
^ ^- method
^- i for integration
Methods include:
- “lefthand”
- “righthand”
- “midpoint”
- “trapezoid”
- “simpsons”
A higher # of parts will give you more precision.
Differentiation
calc "x^2 + 3*x + 5" d
^- d for differentiation
Finds the derivative with respect to x.
Simplification
calc "5 * x / 5 + 2 - 2" s
^- s for simplification
Simplifies the expression by eliminating unnecessary terms, using a few rules. There's definitely more to add here.
Chained
You can chain together operations like this:
calc "x^(3/2) - 2 * (1 / x) i midpoint 1 2 3 d d s
Building
This was also written to learn Crystal. I think it's a nice language, but I added a Makefile for simplicity:
Build (debug)
make all
Build ("release")
make MODE=release all
Repository
calc
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- about 3 hours ago
- January 16, 2026
License
MIT License
Links
Synced at
Fri, 16 Jan 2026 07:35:07 GMT
Languages