Setting a variable to be equal to multiple numbers

I want students to enter in an equation, but there will be decimals in it. Lets say the format is
y=mx+b

when they enter m, I want the fraction form to be correct, but also 1.235 and 1.2345, ect.

how can I write m in such a way that m=2469/2000 or 1.2345 or 1.235

What’s the context you’re doing this in?

Can you convert it to an xyLine and then compare rounded slopes?

something like:

line=xyLine(input.latex)
correct: numericValue("\rnd(${myslope},3)") = numericValue(“rnd(${line.slope},3)”)

1 Like

That was a good idea. I had to twweak it a bit, but this seems to work out well

m=numericValue("\frac{\left(-${a}\right)}{\left(${b}\right)}")

q=numericValue("\frac{\left(${c}\right)}{\left(${b}\right)}")

eq="${a}x+${b}y=${c}"

j = simpleFunction("${m}x+${q}", "x")


inval = (simpleFunction(fn1, "x").evaluateAt(9))

actval=j.evaluateAt(9)
actvalround3=numericValue("\\operatorname{round}\\left(${actval},3\\right)")
actvalround2=numericValue("\\operatorname{round}\\left(${actval},2\\right)")
actvalround1=numericValue("\\operatorname{round}\\left(${actval},1\\right)")
actvalround0=numericValue("\\operatorname{round}\\left(${actval},0\\right)")

fn1=t.cellContent(1,2)




correct = when j.evaluateAt(9)=inval
            or  numericValue("\\operatorname{round}\\left(${inval},3\\right)") = actvalround3
            or  numericValue("\\operatorname{round}\\left(${inval},2\\right)") = actvalround2
            or  numericValue("\\operatorname{round}\\left(${inval},1\\right)") = actvalround1
"Correct" otherwise "Not there yet, keep working"