Input inequality showing up on a graph

Not really sure where to begin with this, that is why I am not attaching a slide. I want students to type in their inequality and when they do the graph that is next to the input box will take their input and graph it. This way they can see visually what their typing in. What would the best way to do this be?

The latest CL newsletter has a bit on parseInequality. https://us5.campaign-archive.com/?u=ebec17c65ade785afdc700908&id=5c72175548

Maybe some of it will be helpful in getting you started

That was a big help. Thanks!

Was just looking into your code on Slide 11. Seems like in1L, in1R, in2L, etc. are uneccesary. Won’t all the lefts = `y` and the rights = ${a}x${signb}${b}. Seems like you could simplify your correctness like this (I’m using nested when-otherwise so it’s not having to recheck the same thing in each when as it would in your original code.)

correct= when inlhs=inL and simpleFunction(inrhs).evaluateAt(9)=simpleFunction(inR).evaluateAt(9) and input.timeSinceSubmit()>0
           (when parseInequality(input.latex).isStrict
             (when f=15 or g=15 1 otherwise 0)
            otherwise (when c=15 or d=15 1 otherwise 0)
            ) 
         otherwise 0

So from what youre saying is that using what you wrote I can just have

inL=parseInequality("y\ge${a}x${signb}${b}").lhs
inR=parseInequality("y\ge${a}x${signb}${b}").rhs

and that will be able to capture all the varients? What about the change in the inequality sign from greater or less, or the equal counter parts?

No, the inequality is different, but the left and right sides are the same for everything, so don’t need to parse at all:

inL=`y`
inR=`${a}x${signb}${b}`

So then what would be the way to check for the right inequality? That is where my problem lies. If it is supposed to be y>3x+2 and they write y<3x+2 then it will still be marked correct. I am not having this issue with my other slides so I am not sure what I am doing incorrectly on this one in terms of the sign check

Work in the isLeftGreater source. I haven’t worked with that source yet, so not quite sure how it works. I assume it ignores strictness and just looks at the inequality sign.

That is a good idea. I forgot about that. Thanks for the suggestion!

1 Like

Here is what I did using your suggestion and it works well. Might be clunky, but oh well

correct= when inlhs=in1L and simpleFunction(inrhs).evaluateAt(9)=simpleFunction(in1R).evaluateAt(9) 
                         and c=15 
                         and not(parseInequality(input.latex).isStrict) 
                         and parseInequality(input.latex).isLeftGreater 
                         and input.timeSinceSubmit()>0 1 
         when inlhs=in2L and simpleFunction(inrhs).evaluateAt(9)=simpleFunction(in2R).evaluateAt(9) 
                         and d=15 
                         and not(parseInequality(input.latex).isStrict) 
                         and not(parseInequality(input.latex).isLeftGreater )
                         and input.timeSinceSubmit()>0 1 
         when inlhs=in3L and simpleFunction(inrhs).evaluateAt(9)=simpleFunction(in3R).evaluateAt(9) 
                         and f=15 
                         and parseInequality(input.latex).isStrict 
                         and parseInequality(input.latex).isLeftGreater 
                         and input.timeSinceSubmit()>0 1 
         when inlhs=in4L and simpleFunction(inrhs).evaluateAt(9)=simpleFunction(in4R).evaluateAt(9) 
                         and g=15 
                         and parseInequality(input.latex).isStrict 
                         and not(parseInequality(input.latex).isLeftGreater )
                         and input.timeSinceSubmit()>0 1 
         otherwise 0
1 Like