I have almost finished the template but there is one more thing that I would like to be able to control. Because desmos Math input evaluates the value (even when the disabled function is on), students can put the same input as output and get right. Do you have any ideas on how to avoid that?
On the example I want 13 to be right but not 7+6. Any ideas?
countNumberUsage is what you’re looking for. It can have one or two parameters. The first is the latex to interpret. The second is the number to search for in the first parameter. If no second parameter is defined, the number of constants/coefficients is counted. Only positive numbers can be used for the second parameter (e.g. 3 or -3 will both register when “3” is the second parameter.
For example, to accept 13, but not 7+6:
and countNumberUsage(this.latex)=1 #checks only one number is used in the answer
and countNumberUsage(this.latex,13)=1 #checks 13 was used only once
Without the first line, -13 would be accepted as correct. Without the second, 13+0 or 13-1+3-2 would be accepted. Without the second and third, as you stated, 7+6 would be accepted. Note that it’s not foolproof, -(-13) is acceptable.
You can use decimals in countNumberUsage. You can also use it to recognize fraction forms, so if you wanted 3/2 but not 1.5
check= this.numericValue=1.5 and countNumberUsage(this.latex,3)=1
Or vice versa:
check= this.numericValue=1.5 and countNumberUsage(this.latex,1.5)=1