← All tools

Math Tools

Generate, analyze, and model numeric data. Sequences, sampling, statistics, correlation, regression, and sliding window operations — all deterministic, no AI premium. Pass a seed for bit-for-bit reproducibility across runs.

Why this matters

LLMs cannot reliably compute standard deviations, fit regression lines, or produce consistent numeric sequences. Math tools handle the full lifecycle: generate data, compute statistics, detect trends, measure correlation — all deterministically. When reproducibility matters — audit trails, regression tests, financial models — pass a seed and the output is identical across runs, servers, and time.

Generation

  • math.range — Evenly-spaced sequences from start to stop with exact step arithmetic
  • math.linspace — Exactly N points between start and stop (NumPy-style)
  • math.sequence — Named sequences: fibonacci, primes, triangular, square, geometric, powers
  • math.sample — Draw from uniform, normal, or exponential distributions with optional seed
  • math.interpolate — Lerp, clamp, remap, smoothstep, and 12 easing functions with batch support

Analysis

  • math.describe — Full descriptive statistics: mean, median, std, variance, percentiles (p5/p25/p50/p75/p95), skewness, and binned histogram for distribution shape
  • math.window — Sliding window operations: moving average, moving sum, cumulative sum, first differences, percentage change, lag, and EWMA
  • math.correlate — Pearson and Spearman pairwise correlation with r-squared, interpretation labels, and scatter-ready paired records
  • math.trend — Regression fitting: linear, polynomial (degree 2–5), exponential, and logarithmic models with r-squared, equation strings, fitted values, and forecasting
  • math.normalize — Scale data using z-score (mean=0, std=1), min-max (to [0,1] or custom range), or percentile rank (0–100)
  • math.outliers — Detect anomalies via IQR or z-score methods; returns outlier indices, threshold bounds, and a cleaned array
  • math.rank — Rank values using ordinal, dense, average, or percentile methods with tie detection

Use cases

  • Test data generation — Reproducible datasets for QA pipelines: seeded samples that don't change between runs
  • Animation and UI — Easing curves, smoothstep transitions, interpolated color ramps for agent-generated interfaces
  • Financial modeling — Time series with moving averages, trend detection, correlation between metrics, Monte Carlo inputs
  • Data quality — Outlier detection with math.outliers, distribution profiling with math.describe, change-point detection with pct_change and first differences
  • Scientific computation — Linspace grids, regression fits, correlation analysis, exact step arithmetic without floating-point drift
  • Quantitative analysis — Moving averages for smoothing, EWMA for signal extraction, trend lines for forecasting, correlation for portfolio analysis

Example: generate and ease

// Generate data, clean outliers, normalize, and fit a polynomial trend
{ "name": "data-grout@1/math.sample@1",
  "arguments": { "distribution": "normal", "count": 200, "mean": 50, "std": 15, "seed": 42 }
}

// Detect and remove outliers using IQR method
{ "name": "data-grout@1/math.outliers@1",
  "arguments": { "cache_ref": "$sample._meta.cache_ref", "method": "iqr" }
}

// Normalize cleaned data to [0, 1] range
{ "name": "data-grout@1/math.normalize@1",
  "arguments": { "payload": "$outliers.clean_values", "method": "minmax" }
}

// Fit a quadratic trend with 10-point forecast
{ "name": "data-grout@1/math.trend@1",
  "arguments": { "cache_ref": "$normalize._meta.cache_ref", "model": "polynomial", "degree": 2, "forecast": 10 }
}

Output is chart-ready — pass records directly to prism.chart for visualization.

Composes with

Feed output into Prism Chart for instant visualization — trend fitted values overlay directly on scatter plots. Pipe integration data through Data or Frame tools for filtering, then into math.describe or math.correlate for analysis. Use math.outliers to clean data before modeling, math.normalize to bring different scales into alignment, math.rank for leaderboards, and math.trend polynomial or exponential fits for planning pipelines.