Math Tools Skill
Perform mathematical calculations and operations without external dependencies.
When to Use
✅ USE this skill when:
-
"Calculate X"
-
"Compute statistics"
-
"Solve equation"
-
"Unit conversion"
-
"Percentage calculation"
-
"Random number generation"
When NOT to Use
❌ DON'T use this skill when:
-
Complex symbolic math → use WolframAlpha API
-
Plotting graphs → use plotting libraries
-
Matrix operations → use Python with numpy
Commands
Basic Arithmetic
{baseDir}/math.sh add 5 3 {baseDir}/math.sh subtract 10 4 {baseDir}/math.sh multiply 7 8 {baseDir}/math.sh divide 20 4 {baseDir}/math.sh modulo 17 5 {baseDir}/math.sh power 2 10
Multiple Numbers
{baseDir}/math.sh sum 1 2 3 4 5 {baseDir}/math.sh product 2 3 4 {baseDir}/math.sh average 10 20 30 40
Statistics
{baseDir}/math.sh mean 1 2 3 4 5 {baseDir}/math.sh median 1 2 3 4 5 {baseDir}/math.sh mode 1 2 2 3 4 {baseDir}/math.sh stddev 1 2 3 4 5 {baseDir}/math.sh variance 1 2 3 4 5 {baseDir}/math.sh range 1 5 3 8 2 {baseDir}/math.sh min 5 3 8 1 9 {baseDir}/math.sh max 5 3 8 1 9
Geometry
{baseDir}/math.sh circle-area 5 {baseDir}/math.sh circle-circumference 5 {baseDir}/math.sh rectangle-area 10 5 {baseDir}/math.sh rectangle-perimeter 10 5 {baseDir}/math.sh triangle-area 10 5 {baseDir}/math.sh triangle-hypotenuse 3 4 {baseDir}/math.sh sphere-volume 5 {baseDir}/math.sh cube-volume 5
Algebra
{baseDir}/math.sh solve "x + 5 = 10" {baseDir}/math.sh solve "2x = 10" {baseDir}/math.sh quadratic 1 -5 6 {baseDir}/math.sh factorial 5 {baseDir}/math.sh fibonacci 10 {baseDir}/math.sh prime 17
Unit Conversion
{baseDir}/math.sh convert 100 cm m {baseDir}/math.sh convert 1 km mi {baseDir}/math.sh convert 100 c f {baseDir}/math.sh convert 32 f c {baseDir}/math.sh convert 1 lb kg {baseDir}/math.sh convert 1 gal L
Percentage
{baseDir}/math.sh percentage 50 200 {baseDir}/math.sh percent-of 25 100 {baseDir}/math.sh percent-change 50 75 {baseDir}/math.sh percent-increase 100 20 {baseDir}/math.sh percent-decrease 100 25
Random
{baseDir}/math.sh random 10 {baseDir}/math.sh random 1 100 {baseDir}/math.sh random-int 1 10 {baseDir}/math.sh random-float {baseDir}/math.sh shuffle 1 2 3 4 5 {baseDir}/math.sh pick 1 2 3 4 5
Trigonometry
{baseDir}/math.sh sin 30 {baseDir}/math.sh cos 30 {baseDir}/math.sh tan 30 {baseDir}/math.sh asin 0.5 {baseDir}/math.sh acos 0.5 {baseDir}/math.sh atan 1
Rounding
{baseDir}/math.sh round 3.7 {baseDir}/math.sh floor 3.7 {baseDir}/math.sh ceil 3.2 {baseDir}/math.sh abs -5 {baseDir}/math.sh sign -10
Number Theory
{baseDir}/math.sh gcd 12 18 {baseDir}/math.sh lcm 4 6 {baseDir}/math.sh prime-factors 60 {baseDir}/math.sh divisors 12 {baseDir}/math.sh is-prime 17
Options
Option Description
--precision N
Number of decimal places (default: 10)
--json
Output as JSON
--quiet
Output result only
Examples
Basic arithmetic:
{baseDir}/math.sh add 5 3
8
Sum multiple numbers:
{baseDir}/math.sh sum 1 2 3 4 5 6 7 8 9 10
55
Statistics:
{baseDir}/math.sh mean 10 20 30 40 50
30
Geometry:
{baseDir}/math.sh circle-area 5
78.5398163397...
Unit conversion:
{baseDir}/math.sh convert 100 km mi
62.1371192237...
Percentage:
{baseDir}/math.sh percentage 25 200
12.5
Random number:
{baseDir}/math.sh random 1 100 --json
{"min": 1, "max": 100, "result": 42}
Solve simple equation:
{baseDir}/math.sh solve "x + 5 = 10"
x = 5
JSON Output
{baseDir}/math.sh mean 1 2 3 4 5 --json
{"operation": "mean", "input": [1, 2, 3, 4, 5], "result": 3}
Notes
-
Uses bash arithmetic and bc for calculations
-
All trigonometry uses degrees (not radians)
-
Precision can be adjusted with --precision
-
Complex math parsed safely
-
No external API calls needed