Returning incorrect feedback on simple functions

I don’t understand why slide 26 is giving the wrong feedback. The two equations should be d=3+w, and 2d=6+2w. I’ve also tried it with x and y, but its returning an incorrect feedback when the exact equation is entered. This is happening for both equations. Please help me correct my mistake.

The first equation looks like it works fine. The second doesn’t work because that form won’t work for simpleFunction which requires an expression, a function in function notation, or an equation with an isolated variable. If a function is not in terms of x, the variable must be specified…

simpleFunction(`d=3+w`, `w`)

So, for the explicit equation 2d=2w+6, you can parse it and use difference function, which you can also evaluate…

parseEquation.differenceFunction(`2d=2w+6`,`d`,`w`)

Note that if you’re looking for specific forms, evaluating can not distinguish between them (e.g. the equation from the first page will give correct feedback using evaluation for the second equation)
If you’re looking for specific form, you’d be better off parsing the left and right sides and using pattern matching.

Thank you very much for your help. Unfortunately, I think this is a little above my skill level, but I’m trying to learn. I’ve done what I thought you were telling me to do, but it didn’t work. Can you tell me what I’m doing wrong?

Here’s the link again.Systems of Equations: Choose your own Journey • Activity Builder by Desmos

Sorry about that. Gave you the wrong syntax…

parseEquation(`2d=2w+6`).differenceFunction(`d`,`w`)

And since there are two variables in the difference function, you need two parameters in evaluateAt( ). Here you can actually check that a solution to the equation would evaluate to 0. Difference function takes the left hand side and subtracts the right hand side. Also, the student also cannot be a simpleFunction and needs to be parsed…

correct_answer = parseEquation(`2d=2w+6`).differenceFunction(`d`,`w`)
student_answer = parseEquation(this.latex).differenceFunction(`d`,`w`)

feedback = student_answer.evaluateAt(3,0) = 0 
           and student_answer.evaluateAt(4,1) = 0 

More robust, comparing each side of the equation…

correctLHS = simpleFunction(`2d`,`d`)
correctRHS = simpleFunction(`2w+6`,`w`)

studentLHS = simpleFunction(parseEquation(this.latex).lhs,`d`)
studentRHS = simpleFunction(parseEquation(this.latex).rhs,`w`)

feedback = studentLHS.evaluateAt(0)=correctLHS.evaluateAt(0)
       and studentLHS.evaluateAt(1)=correctLHS.evaluateAt(1)
       and studentRHS.evaluateAt(0)=correctRHS.evaluateAt(0)
       and studentRHS.evaluateAt(1)=correctRHS.evaluateAt(1)

Once again, I really appreciate your help, but its still not working for me. I’m almost finished with the activity, but that slide is still a problem. It only returns a correct response when the equations are typed in the exact order as the way I typed them. I know my students won’t all type it in the same way.

The slide in question is still slide 26. Here’s the link to the activity: Draft: Choose your own Journey: Systems of Linear Equations • Activity Builder by Desmos

If you want students to be able to swap sides of the equation, add a second possible check:

feedback2 = studentLHS.evaluateAt(0)=correctRHS.evaluateAt(0)
        and studentLHS.evaluateAt(1)=correctRHS.evaluateAt(1)
        and studentRHS.evaluateAt(0)=correctLHS.evaluateAt(0)
        and studentRHS.evaluateAt(1)=correctLHS.evaluateAt(1)

Thank you. I did that, but it still isn’t working. I can reverse the terms on the right side of the equation and get a correct response, but it still says incorrect when I switch the left and right sides of the equation.

You need to include feedback2 as part of your correct sink and resetLabel

resetLabel: 
  when feedback or feedback2 "Correct!"
  otherwise "Incorrect. Try again!"
  
correct: feedback or feedback2

or turn feedback into a large or statement…

feedback = ( studentLHS.evaluateAt(0)=correctLHS.evaluateAt(0)
         and studentLHS.evaluateAt(1)=correctLHS.evaluateAt(1)
         and studentRHS.evaluateAt(0)=correctRHS.evaluateAt(0)
         and studentRHS.evaluateAt(1)=correctRHS.evaluateAt(1) )
         or 
          ( studentLHS.evaluateAt(0)=correctRHS.evaluateAt(0)
        and studentLHS.evaluateAt(1)=correctRHS.evaluateAt(1)
        and studentRHS.evaluateAt(0)=correctLHS.evaluateAt(0)
        and studentRHS.evaluateAt(1)=correctLHS.evaluateAt(1) )

Thank you so much. I feel like I should’ve seen that. So grateful for your help.