npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mathrok

v1.1.4

Published

AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving

Readme

Mathrok - AI-Powered Symbolic Mathematics Library

npm version License: MIT TypeScript Bundle Size

Mathrok is a comprehensive symbolic mathematics library that combines traditional Computer Algebra System (CAS) capabilities with natural language processing, voice interaction, and visualization features for advanced mathematical problem-solving.

Features

  • Symbolic Mathematics: Solve equations, calculate derivatives, integrals, limits, and more
  • Natural Language Processing: Understand and solve math problems expressed in plain English
  • Step-by-Step Solutions: Detailed explanations with educational content
  • Voice Interaction: Speech-to-text for mathematical expressions and audio explanations
  • Visualization: 2D and 3D function plotting with mathematical notation rendering
  • Performance Optimized: Intelligent caching, lazy loading, and minimal bundle size

Installation

npm install mathrok

Quick Start

import { Mathrok } from 'mathrok';

// Initialize the library
const mathrok = new Mathrok();

// Solve an equation
const result = await mathrok.solve('x^2 + 2x - 3 = 0');
console.log(result.result); // [-3, 1]

// Calculate a derivative
const derivative = await mathrok.derivative('sin(x)', 'x');
console.log(derivative.result); // cos(x)

// Process natural language
const nlResult = await mathrok.nl('find the derivative of x^2');
console.log(nlResult.result); // 2*x

// Visualize a function
const container = document.getElementById('graph-container');
mathrok.visualization.plot2D(container, 'sin(x)', 'x', {
  xMin: -Math.PI,
  xMax: Math.PI
});

// Use voice input
const voiceResult = await mathrok.voice.listen();
console.log(voiceResult.text); // "solve x squared plus 2x minus 3 equals 0"

Documentation

Comprehensive documentation is available in the docs directory:

Core Features

Symbolic Mathematics

// Solve equations
const eqResult = await mathrok.solve('x^2 - 4 = 0');

// Calculate derivatives
const derResult = await mathrok.derivative('x^3 + 2x^2', 'x');

// Calculate integrals
const intResult = await mathrok.integral('x^2', 'x');

// Factor expressions
const factorResult = await mathrok.factor('x^2 - 4');

// Simplify expressions
const simplifyResult = await mathrok.simplify('2x + 3x');

// Matrix operations
const matrixResult = await mathrok.matrix.multiply([[1, 2], [3, 4]], [[5, 6], [7, 8]]);

Natural Language Processing

// Basic NL processing
const result = await mathrok.nl('find the derivative of x^2 sin(x)');

// Advanced multi-step problems
const advResult = await mathrok.nl('first factor x^2 - 4 then solve x^2 - 4 = 0');

// Educational explanations
const explainResult = await mathrok.explain('derivative', 'beginner');

Voice Features

// Check if voice is supported
const support = mathrok.voice.isSupported();

// Listen for mathematical input
const voiceInput = await mathrok.voice.listen();

// Speak a mathematical expression
await mathrok.voice.speak('The derivative of x squared is 2x');

// Speak a step-by-step solution
await mathrok.voice.speakSolution(steps);

Visualization

// Plot a 2D function
mathrok.visualization.plot2D(container, 'sin(x)', 'x');

// Plot a 3D function
mathrok.visualization.plot3D(container, 'sin(x)*cos(y)');

// Plot multiple functions
mathrok.visualization.plotMultiple(container, ['sin(x)', 'cos(x)'], 'x');

// Render mathematical notation
const latex = mathrok.visualization.renderMath('\\frac{d}{dx}x^2 = 2x', 'latex', true);

Advanced Configuration

// Configure the library
mathrok.config.set({
  precision: 10,
  timeout: 5000,
  aiEnabled: true,
  cacheEnabled: true,
  voiceEnabled: true,
  visualizationEnabled: true
});

// Monitor performance
const metrics = mathrok.performance.getMetrics();
console.log(`Average operation time: ${metrics.averageTime}ms`);

Browser Support

Mathrok works in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js environments. The voice features require browser support for the Web Speech API.

License

MIT © Mathrok Team

Contributing

Contributions are welcome! Please see our Contributing Guide for more details.