# Evaluating an expression

I want to have a question that asks students whether an ordered triple satisfies a plane’s equation. I know that I need to have three different math inputs since Desmos only recognizes ordered pairs, and that’s fine - I have three inputs called ans_x, ans_y, and ans_z.

I can’t seem to get the right syntax to evaluate the function. For the purposes of this question, let’s say that the equation of the plane is 2x+y+z=1.

I think I want to use something like simpleFunction. Here’s the relevant snippet:

``````plane = simpleFunction("2a+b+c", "a", "b", "c")
checkValue = plane.evaluateAt(ans_x.numericValue,ans_y.numericValue,ans_z.numericValue)
when checkValue = 1 "Correct!"
otherwise "Incorrect"
``````

If this is in a Note component, you just need to add the sink
`content: when . . .`

I was unclear; sorry. The content: when is already there, but earlier, because I’ve got this snippet only resolving when ans_x, ans_y and ans_z are submitted. Is that my problem? Should the plane and checkvalue be defined before the initial content condition list?

What she means is, the last two lines of your code need to be preceded by "content: ". As is, your when-otherwise is part of the `checkValue` definition on line 2.

``````plane = simpleFunction("2a+b+c", "a", "b", "c")
checkValue = plane.evaluateAt(ans_x.numericValue,ans_y.numericValue,ans_z.numericValue)
content: when checkValue = 1 "Correct!"
otherwise "Incorrect"
``````

With the content sink added in, it seems to work fine. Without your activity link, I have to assume ans_x, ans_y, and ans_z are all math inputs.

Did you want to give them a few ordered triples and ask if they’re on the plane like this?

1 Like