Self-checking math input with two solutions

I am creating a self-checking assignment for Algebra I where students need to find the roots/solutions of a quadratic given in standard form. Does anyone know how to allow two possible answers in a math input (so that a student could enter either intercept and be correct)? Also, how can I enter a fraction as the correct answer?

See slide 9 in the activity:


Try this for input 3:

correct = this.numericValue = 5 or this.numericValue = simpleFunction("x/y", "x", "y").evaluateAt(-1,3)

and then this for input 4:

correct = (this.numericValue = 5 or this.numericValue = simpleFunction("x/y", "x", "y").evaluateAt(-1,3)) and not(this.numericValue=input3.numericValue)

It worked!! Thanks so much!

Hi! I followed your instructions for slides 9-12. When I went back to check everything again, now the 2nd box is correct for any values except the one that is correctly entered in the first box. FYI…I added the equivalent decimal form for each fraction; not sure if that’s a contributing factor to the problem. Thanks for the help!

You’re right, I had the first conditional wrong. It basically said if the first input was correct and the second didn’t match the first, it was correct. That’s definitely not what we want! I adjusted my original post to something that should work now. Good catch!

Thanks so much for following up and that fix on the 2nd input did the trick. There is a strange different issue going on though that I can’t figure out now. I put in the decimal form of each fraction only in the first input on slides 9-12 and copied the code for the 2nd input as you wrote it. On slides 10-12, if I put the decimal form in the first box, I cannot use the fraction form in the 2nd box (and vise versa) and get the 2nd one correct, which is perfect! However, only on slide 9, if I put the decimal value in first, the fraction form also reads correct (see the screenshots for an example). I even tried to just copy slide 10 and reenter the values from slide 9 and it does the same thing only when the decimal form is entered first.

Screen Shot 2021-01-13 at 4.41.02 PM Screen Shot 2021-01-13 at 4.41.39 PM

Two things to fix that. First, make sure to enter an acceptable form for the decimal in the second input. Second, since the two numbers are close in value but not equivalent, we can check to see if the numbers are within a certain distance from each other. This checks to see if they are within a tenth of a unit. This would go in the second input again.

correct = (this.numericValue = 5 or this.numericValue = simpleFunction("x/y", "x", "y").evaluateAt(-1,3) or this.numericValue = -0.3) and not(numericValue("\abs(${input3.numericValue}-${this.numericValue})")<=0.1)
1 Like

It works! Thanks again for all of the help today!

Can you please check Slide #1, it is showing on the dashboard dots, why it is not showing correct check or wrong X

The math input had the correct sink and a readOnly sink, so the only thing that was being read was the sketch. If you remove the readOnly: true from the input and move it to the sketch, that should do the trick.

Can someone please make a activity as an example of how to do it i don’t really understand.
An example of what I want to do is like the awenser could be 3sqrt3 or 10.53

Currently Slide 1:

1 Like