Evaluating with two variables in a table

Hey all!

I’m hoping someone can give me some advice. I’m trying to create a self-checking activity for students evaluating partial derivatives.
What I would like is for the student screen to look like this

And students would type in the partial derivatives to each spot and if they were correct they would see a little checkmark and if not they would see a sad face. I’ve done activities similar to this in the past but I’m running into the issue that the solutions would have two variables.

For this example the solution to fxx would be 3x^2+2xy^2

So I thought this code might work, but it did not:
#Table Values
a1=table1.cellContent(1,2)
a2=table1.cellContent(2,2)
a3=table1.cellContent(3,2)

a4=table1.cellContent(1,4)
a5=table1.cellContent(2,4)
a6=table1.cellContent(3,4)

eq1=parseEquation(this.cellContent(1,2)).differenceFunction(“x”,“y”)

checkf1=eq1.evaluateAt(1,1)=5 and eq1.evaluateAt(2,2)=28

cellSuffix(1,2):
when checkf1 “:heavy_check_mark:
otherwise “:neutral_face:

My other issue is I need a way to tell the note to display the great job you got them all correct message?
I was thinking that a code like this but with all 6 check function recalls?
${result}"

result =
when table1.script.checkf1 and table1.script.checkf2 “Great Job! :grin:
when table1.submitted “\n\n\Incorrect. Go back and check each of your partial derivatives.”
otherwise “”

Any advice is much appreciated!!

You need to use .latex when you parseEquation (and a1 since you made the variable), so…
eq1=parseEquation(a1.latex).differenceFunction(“x”,“y”)

Your result should work, then in your note or wherever:
content: "${result}"

Thanks! So I switch to a1 (since that was the variable I had defined) and added the .latex, but now it’s running an error: There are no supported members of type string?
image

Maybe made a mistake. Try without .latex and instead

...parseEquation("${a1}")...

I tried switching it but, it’s still not working. It’s slide 8 of this activity

Since you’re really just typing in an expression, you should use simpleFunction. I tried this and it displayed the check mark:

checkf1=simpleFunction(a1, "x", "y").evaluateAt(1,2)=11 and simpleFunction(a1, "x", "y").evaluateAt(2,1)=16
2 Likes

Didn’t even think of that. Without “=” parseEquation doesn’t work because it basically creates the two sides of the equation.