Checking for correctness when simplifying an expression

Hello,
Could someone please show me what CL code to use if I want to check for correctness when asking students to simplify an expression. For instance, if I wanted students to simplify \sqrt{\frac{8p^{7}}{32p^{3}}}. I know that if I just wanted students to give the answer to sqrt (20), I just use the “correct:” code. However, once I add a letter to the answer, it seems like it changes things and says “Top level declarations must be variable or sink assignments”.

Thank you!

Probably want to look into the pattern matching, which could get a little complicated here. There are ways to evaluate it after creating a function from the student input in a graph’s CL (like this graph), but that won’t know if it’s simplified.

In a math box you can do correct: this.latex=`\sqrt{20}`

That wasn’t the target answer, but regardless, a quick tip, in the forums if you surround code using triple backticks it won’t leave out anything you typed:

correct: this.latex=`\sqrt{20}`
1 Like