cs-math

Installation
SKILL.md

cs-math

Purpose

This skill enables OpenClaw to perform computations in computer science mathematics, covering discrete math (e.g., sets, graphs), combinatorics (e.g., permutations), probability (e.g., distributions), linear algebra (e.g., matrix operations), and calculus for ML (e.g., gradients), using optimized algorithms.

When to Use

Use this skill for tasks involving mathematical computations in code, such as calculating probabilities in algorithms, solving linear systems for ML models, or analyzing combinatorics in data structures. Apply it when precise, programmatic math is needed, like in optimization problems or statistical analysis, rather than general queries.

Key Capabilities

  • Compute discrete math operations: permutations, combinations, graph traversals (e.g., via adjacency matrices).
  • Handle probability: calculate expected values, binomial probabilities, or simulate distributions.
  • Perform linear algebra: matrix multiplication, determinants, inverses, and eigenvalue calculations.
  • Support calculus for ML: compute gradients, partial derivatives for loss functions.
  • Integrate with data: process arrays or vectors from inputs, returning results as JSON.

Usage Patterns

Invoke the skill via OpenClaw's CLI or API by specifying an operation and parameters. Always pass inputs as a JSON object for consistency. For example, in Python code: import openclaw; result = openclaw.invoke_skill('cs-math', {'operation': 'permutation', 'n': 5, 'r': 3}). Handle outputs as dictionaries, e.g., check for a 'result' key. Use try-except blocks for API calls to catch failures. If reusing parameters, store them in a config file like JSON: {"default_n": 5}, and load it before invoking.

Related skills
Installs
32
GitHub Stars
5
First Seen
Mar 5, 2026