You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mathrok

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathrok

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

1.1.4
latest
Source
npmnpm
Version published
Weekly downloads
285
Maintainers
0
Weekly downloads
 
Created
Source

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.

Keywords

mathematics

FAQs

Package last updated on 03 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.