Error accepting answers from randomly generated values

Hi there!

I can’t figure out how the get the coding to accept answers that use randomly generated values.

For example, in part (a) of the task since one factor is programmed as “bx+c”, the x-intercept should be “c/b”. However I don’t know how to program the computation layer to accept that “c/b” value.

I also don’t know how to set the computation layer for part (d) so it accepts the vertex answer as a coordinate.

Here’s what I have so far: Solving for Quadratic Features - generated eqs and self checking • Activity Builder by Desmos

I tried looking for other tasks that could help me figure this out, but so far have no luck. =/

This may help:

I tried your Method 3 suggestion since students are working with values from a randomly generated equation, not pre-set table values.

I tried defining another variable: f = {c/b} and setting the feedback to equal f, but that didn’t work since students need to use the randomly generated b- and c-values and enter “c/b” as their answer. Here’s what I tried for those lines:
b = numericValue((-1)^{${r.int(1,2)}}*${r.int(1,2)})
c = numericValue((-1)^{${r.int(1,2)}}*${r.int(0,9)})
f = numericValue(c/b) (I also tried defining f = {c/b} with no luck)
feedback = when input1.submitted and input1.numericValue=f "\\textcolor{green}{\\mathrm{Correct!}} :white_check_mark:"

The task you shared is a great task and I plan to use that for remediation, but not quite what I’m looking for. Not sure if what I need is possible?

When you’re using variables from your CL in a calculation, you must always use ${ }, so for f:

f= numericValue(`${c}/${b}`)

Is there a way define f so it’ll accept an equivalent numerical value to numericValue(${c}/${b}) so students aren’t required to enter exactly c/b? For example, if c/b = -3/-1, then it’ll accept 3 as a correct answer.

I mistyped it - ignore that last message.

Thank you for your help!

You can use countNumberUsage to search for specific numbers (and how many times they’re used), but the parameters only take positive values and wouldn’t be able to distinguish between -3/-1 and 3/1.

This online community is such an awesome resource. All of us teachers appreciate what you’ve provided for us. <3

Here is the final product in case other teachers want to use this task or something similar to it: Solving for Quadratic Features - generated eqs and self checking • Activity Builder by Desmos

It would be great if it’ll accepts (x,y) coordinate answers instead of just numerical answers. But I’m happy with this end product.

parseOrderedPair gives you this functionality. Say for wanting a point in an input that is (3,-2):

myPair= parseOrderedPair(input.latex)
check= myPair.x=3 and myPair.y=-2
correct: check

Hmmm… So for something like this where correct coordinate answers are dependent on the randomly generated values, I kept the defined values h and i like before:

#h determines x-value for vertex from previously defined variables
h = numericValue((-${c}*${d}-${b}*${e})/(2*${b}*${d}))

#i determines y-value for vertex from previously defined variables
i = numericValue(${a}*(-${c}*${d}-${b}*${e}+2*${c}*${d})*(-${c}*${d}-${b}*${e}+2*${b}*${e})/(4*${b}*${d}))

Now when I include “myPair” and adjust the feedback to include (x,y) this to task, it doesn’t accept the coordinates and shows error in the coding:

myPair= parseOrderedPair(input3.latex)
check= myPair.x=h and myPair.y=i
correct: check

feedback = when input3.submitted and input3.numericValue=(x,y) "\\textcolor{green}{\\mathrm{Correct!}} :white_check_mark:"
when input3.submitted “:x: Try again! You need to use the Zero Product Property on the factors.”
otherwise “”

Sorry, I always forget this. I think you need to do numericValue(myPair.x)

Where would that coding numericValue(myPair.x) go in the below computation layer?
myPair= parseOrderedPair(input3.latex)
check= myPair.x=h and myPair.y=i
correct: check

I already defined h and i as:
#h determines x-value for vertex from previously defined variables
h = numericValue( (-${c}*${d}-${b}*${e})/(2*${b}*${d}) )
#i determines y-value for vertex from previously defined variables
i = numericValue( ${a}*(-${c}*${d}-${b}*${e}+2*${c}*${d})*(-${c}*${d}-${b}*${e}+2*${b}*${e})/(4*${b}*${d}) )

Replace myPair.x with numericValue(myPair.x), and do the same change for the y-coordinate. If I remember correctly, parseOrderedPair converts the coordinate values to a string, so that’s why you weren’t able to compare the values with the previous code.

Specifically in the check variable:

check=numericValue(myPair.x)=h and numericValue(myPair.y)=i

@cwinske & @Daniel_Grubbs - thanks for the suggestions. It makes sense why I would need to redefine the input. But now I get errors for the following lines:

myPair = parseOrderedPair(input3.latex)
check = numericValue(myPair.x) and numericValue(myPair.y) ← error message stated "Expected 2 arguments of types [boolean, boolean], got [number, number]"

correct: check = numericValue(myPair.x)=h and numericValue(myPair.y)=i ← error message stated "The statement defining variable check has an error"

feedback = when input3.submitted and input3.numericValue=(x,y) "\\textcolor{green}{\\mathrm{Correct!}} :white_check_mark:" ← error message stated "Syntax error: Expected ) token but found ,"

when input3.submitted ":x: Try again! You need to use the Zero Product Property on the factors."
otherwise ""

The incorrect parts should look like this:

myPair = parseOrderedPair(input3.latex)
check = numericValue(myPair.x)=h and numericValue(myPair.y)=i

correct: check

feedback = when input3.submitted and check "\\textcolor{green}{\\mathrm{Correct!}} :white_check_mark:"

when input3.submitted ":x: Try again! You need to use the Zero Product Property on the factors."
otherwise ""