Expanding Log Correctness

Wondering if anyone can give me some advice. I have created a slide to check correctness for Expanding/Condensing logs but I think there is probably a better way to do this. I used pattern matching. It would have been nice to have a “log” pattern match.

Thank you

Looks like natural log is not recognized in CL without a backslash before it. I figured out a hack to make an evaluative method work by converting student latex into text first (since it will insert the slashes), then using that text for a simpleFunction in concert with some basic pattern matching:

matchExp=p.difference(p.difference(p.sum(p.expression,p.expression),p.expression),p.expression).matches(this.latex) 
   and simpleFunction(expText,"x","y").evaluateAt(5,4)=simpleFunction(`\ln(\frac{4x}{7y^{2}})`,"x","y").evaluateAt(5,4)
expText="${this.latex}"
suffix: when matchExp  "✅" otherwise "NO"

(Edit: I was hoping this would be a way to get function notation to work, but no dice.)

oh wow, converting it to text works…Great to know. Thank you.

@Daniel_Grubbs
Dan,
Any Idea how I would pattern match 5\ln\left(x+3\right)?

I’d probably verify that it’s a single expression and not( ) a sum or difference, and maybe use countNumberUsage for the 5 and 3.