GithubHelp home page GithubHelp logo

Don't allow 0th root about mathsteps HOT 8 OPEN

evykassirer avatar evykassirer commented on July 4, 2024
Don't allow 0th root

from mathsteps.

Comments (8)

hmaurer avatar hmaurer commented on July 4, 2024 2

Oh yes of course; I'll check out some of the other issues.

from mathsteps.

adamisntdead avatar adamisntdead commented on July 4, 2024 1

I am happy to pick this one up, if thats okay?

from mathsteps.

hmaurer avatar hmaurer commented on July 4, 2024

I am on this. Could you assign me to it? It's easier to filter :)

from mathsteps.

evykassirer avatar evykassirer commented on July 4, 2024

Actually I'd appreciate if you could work on a maximum of 1 small PR for now, since I want to make it easy for people to start on this project and it'll take a bit of time to find more small tasks for folks.

Would it be alright to leave this for another eager newcomer? I'm happy to discuss some other slightly bigger PRs with you if you want to find something else to work on :)

And, of course, thanks so much for your interest. It is so great to have someone else so on board 😀 😀

Also, I can't assign things to people unless they're on the collaborators list (have read and write access, which will probably stay Socratic people for now) - sorry, I know that's inconvenient. We might be able to find another system to help keep track of PRs for people - let me know if you have ideas!

from mathsteps.

adamisntdead avatar adamisntdead commented on July 4, 2024

Just looking now, the nthRoot Code seems to be on the math.js side, so changing it would be changing the actual mathjs code. Is that correct, or am I missing something?

from mathsteps.

hmaurer avatar hmaurer commented on July 4, 2024

@adamisntdead Check out #29.

The operation nthRoot with base 0 would lead to an exception when trying to evaluate it with mathjs. For example, try this (at the root of the project after cloning the repository):

const mathsteps = require('./');
mathsteps.simplifyExpression('nthRoot(5, 0)');

In attempting to simplify nthRoot(5, 0) the program is going to evaluate it, and it will throw an error in our face: Error: Root must be non-zero. That's not great; what would be better instead would be to return a step with changeType NTHROOT_BY_ZERO or something (not sure...) and stop the simplification process. Essentially we're modelling an error as a changeType (I think? @evykassirer).

I hope this helps!

from mathsteps.

evykassirer avatar evykassirer commented on July 4, 2024

yay @adamisntdead thanks for taking this on!

What @hmaurer said sounds right. Ideally a student could enter anything and give something back. If we throw an error, the tech that's using mathsteps might not know what to do.

So if someone asked 2 + 4 + nthroot(4, 0), we should give the step:

2 + 4 + nthroot(4, 0) -> 2 + 4 + nthroot(4, 0) (ie no change)
changeType: NTHROOT_BY_ZERO_ERROR (or whatever you want to call it)

Checking for 0th root should look through the whole tree before we start, because there's no point in doing other steps (like adding 2 and 4 above) if there's gonna be an error anyways.

How's that sound? Please ask if this is confusing or if you have any other questions :) thanks again for volunteering to work on this 😸

(aside: later, it would be nice to give users of mathsteps a way to check if a changeType is an error, but you don't need to do that)

from mathsteps.

evykassirer avatar evykassirer commented on July 4, 2024

this has gotten more complicated with #129 (sorry for being misleading!)

BUT once that's all done, this will still be a nice small change. I'll just add the "blocked" label to wait until #129 and #29 are done :)

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.