How do I create literal equation with feedback in CL?
I don’t entirely understand your question. An example would be helpful.
If you mean something like the equation of a circle, then what you’re looking for is probably parseEquation( ).differenceFunction( ). Slide 2 of this activity uses it (and parseInequality) to handle both equations and inequalities, as well as a method of correction to match a target inequality or equation (change the variable “target” in the graph CL).
If you want variables other than x and y, you’ll need to change the x and y in a number of places in the CL and in the graph.
An example of the type of problem I want to give is
“Solve for t in D = rt and I want the student to give me t = D/r.” (Actually, the prettier form of the fraction.)
I’d probably use pattern matching for this.
In a math input’s CL:
p=patterns
eq=parseEquation(this.latex)
check= p.literal(`t`).matches(eq.lhs) and p.fraction(p.literal(`D`),p.literal(`r`)).matches(eq.rhs)
correct: check
#if you want student feedback:
suffix: when not(this.submitted) ""
when check "✅"
otherwise "❌"