I have some criteria that I want students to follow, but I like the idea of leaving some choice for them in what equation to write. Does anyone know how I could check PART of their equation?
For rational functions, I could specify that the numerator must be degree three and a specific horizontal asymptote. I figured out how to check the HA with a workaround, checking their function value at an extreme x and comparing to the correct HA, but what about other criteria?
I’m thinking specifically for screen two in this activity:
test2 =
when diff.evaluateAt(fn2.evaluateAt(10000), ref.cellNumericValue(2,2)) < 0.2 true
otherwise false
diff is |x-y| where x is the student input equation evaluated at x=10,000 and y is the exact numeric value of the HA specified in column 2 of the table.
For other degree and coeffiencient criteria, you can check for particular numbers using countNumberUsage, but you can’t tell where they are.
With new announcement and updates for the CL documentation, you may be able to parse the numerator and denominator with some of the pattern methods. Check out slide 15 in this CL example.
Documentation is pretty sparse. Do you know of anywhere with the pattern options written out? The script and options don’t autocomplete like others (bc beta feature?)
What type is cellContent? I’m trying to get it to play nice with parse notation like how you have but I’m not getting what I expect.
I got it to read the pure expression, but when I put y= at the start it breaks. I’m using simpleFunction(parseEquation(latex).rhs) right now so but neither parseEquation nor simpleFunction outputs latex for matching with pattern.
I guess I can just not parseEquation and remove the initial y=…
You’re on the right track. The pattern library only reads expressions so an equation will break it. You need to use parseEquation to separate your lhs and rhs (both strings), then match the pattern to one of those strings at a time. it’ll probably look something like