Hi,
First question here.
I’ll like to ask student to submitte the equation of a graphic in input box in an activity.
It’s work fine with integer and float, but not when I use fraction.
In my window, I use graphic, text area where «Good answer» and «bad answer» will appear (where the code was) and an input box (call inputc2) set in latex.
There is the code in the text area:
content:
when c2input.submitted and c2input.latex = “y=\frac{1}{3}x-1” “\n\Good job !”
when c2input.submitted “Try again!”
otherwise “”
I cut n past my equation in the preview to put in in my code…
Just a reminder that, for many of the same reasons that you’re hitting, trying to exactly match latex that students have entered will be frustrating and unreliable for them as well. Things like -1+1/3x, 2/6x-1, or even putting a space somewhere in the equation will cause correct responses to be marked as wrong. Checking if the equation passes through the right points using simpleFunction(), or using xyLine() to check the slope and intercept will help make this a much better experience for your students.
Let the correct answer be some function in the graph, say, “f” and the student input is “g”.
Then in the graph component you can create a list of inputs say X=[-5…5] and check if the difference between the desired function (f) and the student input (g) is zero. f(X)-g(X).
If it is zero I make the output 1 and if it is not then 0. Adopting this convention is useful because of the properties of 0 and 1 – especially if you are correctness checking multiple inputs.