
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving
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.
npm install mathrok
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"
Comprehensive documentation is available in the docs directory:
// 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]]);
// 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');
// 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);
// 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);
// 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`);
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.
MIT © Mathrok Team
Contributions are welcome! Please see our Contributing Guide for more details.
FAQs
AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving
The npm package mathrok receives a total of 285 weekly downloads. As such, mathrok popularity was classified as not popular.
We found that mathrok demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.