GithubHelp home page GithubHelp logo

Comments (2)

evykassirer avatar evykassirer commented on July 24, 2024

An excellent question!

Wanting a good answer to this question is one of the big reasons I want a wiki ( #66 ) but here's a casual short-ish explanation in the meantime...

When we were building this, we wanted to have really good descriptions of the steps. In the blog post I have a short passage that says:

We also want to allow users of mathsteps to reference what changed specifically in the expression, for example “add 2 and 3 to make 5”. We keep track of what part of the tree changed in the node.

If you ran mathsteps on x + 2 + 3 you'd get a single step with step.oldNode being the tree for x + 2 + 3, and step.newNode being the tree for x + 5. Also, step.changeType would be SIMPLIFY_ARITHMETIC.

In our app, we don't want the message to be "simplify arithmetic", we want it to be "add 2 + 3 to get 5" or something like that. So the oldNode and newNode need to store what part of the tree was changed. In oldNode, the 2 and 3 nodes in the tree have the added property changeGroup = 1. And in newNode, 5 also has changeGroup = 1. The change groups are indexed because for something like collecting like terms (x + x^2 + x^2 + x -> (x^2 + x^2) + (x + x)) it's ideal to have different change groups for the xs and the x^2s

For the most part, these change groups are added by default in NodeStatus creation, but sometimes custom ones are necessary (like the like terms collecting) and it's done while the change is calculated.

Also, this change group stuff is still pretty buggy/incomplete and won't always do what's best - this is something that would be nice to eventually spend some time on and improve but there are some tricky things that make some cases pretty hard.

Hope that makes some sense - I know it's not one sentence but it's a bit complicated (which is also why I didn't talk about it in the blog post). Let me know if you have any follow-up questions!

from mathsteps.

hmaurer avatar hmaurer commented on July 24, 2024

I see; that's what I thought (I was looking for the part of the code keeping track of which nodes changed) but wasn't quite sure why it was indexed; thanks!

from mathsteps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.