I want my students to input the equation of a line. How do I add a script to the slide that will enable desmos to check the accuracy of their answer?
For example the correct answer is y=-70x+420 but y=420-70x is also acceptable.
#turns student input into a line object (accepts ANY form of line)
myLine=xyLine(inputName.latex)
#grabs the numeric values for slope and y-intercept
m=myLine.slope
b=myLine.yIntercept
#checks that they are equivalent to intended values.
check= m=-70 and b=420
correct: check
Thank you for answering my question! However when I copy and paste into the script I get this error message:
I am not sure what components need naming? or how to name them?
GeorgiaA
I figured it out!! Thanks again for your help Daniel!
Next question: I want the kids to put in F = 2.5d + 3 on another slide. (instead of βxβ and βyβ). How can I change that?
Also what if the slope is 1/3?
For F=2.5d+3
, the F is fine as simpleFunction really only looks at the right hand side (you can use function notation too). For βin terms of dβ, use:
simpleFunction("inputName.latex","d")
You can also have multivariable functions by adding more parameters.
The slope, using xyLine
, will be in decimal form regardless of how a student inputs it.
So how would you do this if you were trying to check that a student entered in a quadratic function? I know it needs to go to the graph but Iβm struggling with what to put in there for the check.
TIA