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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mathsteps-expermental-fork

v0.4.6

Published

Step by step math solutions. Experimental Fork

Downloads

40

Readme

Mathsteps - Experimental Fork (Name TBD)

This is an experimental fork of Kemu Studio's mathsteps, a step-by-step solver for math problems. This fork introduces several significant changes and improvements:

Major Changes & Future Changes

  • Converted CommonJS to ESM: Modernized the module system.
  • Added TypeScript/JSDoc Support: Enhanced code quality and developer experience.
  • Optimized for Browser Use: Tailored for better performance in web environments.
  • Modernized ESLint Configuration: Ensured code adheres to contemporary JavaScript standards.

Considering the extensive changes and my limited familiarity with some of the original code's intentions, merging this fork back into the main mathsteps repository might not be feasible. However, it remains a possibility for the future. KemuStudios is free to contact me if they think my future work could benefit the main project.

New Project Focus

The primary goal of this fork is to add an ability to evaluate users' steps in solving math problems and diagnose where they might have gone wrong. The current implementation uses existing solving rules to find all possible next steps. This feature is still a work in progress and may not yet be highly performant.

Check out main.js to see the current implementation of this feature in action.

Installation

  1. Clone this repository:
    git clone <repository-url>
  2. Install all dependencies:
    pnpm install

Usage for Evaluating User Steps (Work in Progress)

  1. Modify the usersteps array in main.js to include the desired user steps.
  2. Run the development server:
    pnpm dev
    Check the console for the current output.

For more information on solving math problems using mathsteps, see the examples below:

Code Examples

Simplifying an Expression

let steps = [];
const newNode = mathsteps.simplifyExpression({
  expressionAsText: '2x + 2x + x + x',
  onStepCb: (step) => {
    steps.push(step);

    // Uncomment the following lines to see alternate forms
    // if (stepMeta.altForms) {
    //   console.log('ALT FORM:', mathsteps.printAsTeX(stepMeta.altForms[0].node));
    //   console.log(stepMeta.altForms[0].node);
    // }
  }
});

steps.forEach(step => {
  console.log("change: " + step.changeType); // change: ADD_POLYNOMIAL_TERMS
  console.log("after change: " + mathsteps.printAsTeX(step.rootNode)); // after change: 6x
});

Simplifying an Equation

const steps = [];
const eventualAnswer = mathsteps.simplifyExpression({
  expressionAsText: userStep,
  isDebugMode: false,
  onStepCb: (step) => {
    steps.push(step);
  }
});

Solving an Equation

const result = mathsteps.solveEquation({
  equationAsText: '2x + 3x = 35',
  unknownVariable: 'x',
  onStepCb: function(step) {
    console.log(`[ ${step.equation.getId()} ] ${step.stepId} | ${step.equation}`);
  }
});

Feel free to contribute, open issues, or suggest improvements. I'd love for this project to be a collaborative effort, and your input is highly valued!