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.
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!}}"
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?
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.
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.
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!}}"
when input3.submitted “ Try again! You need to use the Zero Product Property on the factors.”
otherwise “”
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.
@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:
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!}}" ← error message stated "Syntax error: Expected ) token but found ,"
when input3.submitted " Try again! You need to use the Zero Product Property on the factors." otherwise ""
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 ""