How do I write a code for "correct equation"

I want my students to graph a sin function with an amplitude of 3 and a midline at y=2

This is a strategy that will work for any function and it relies on the use of the calculator. Here’s the functions you can use in the calculator:

In the graph component, use this CL:

function(`f`): simpleFunction(input.latex)

I’m not sure if you’re just looking for a dashboard display or some other feedback, but when the C_{heck} variable in the graph equals 1, the graph is correct.

I want the students to check: y=4sinx/3pi to know they have the right equation

Take the calculator screen I shared earlier and copy the URL. Open the graph on the activity you’ve shared and paste the URL into a line with an empty expression. In the folder that says “Correct Function,” enter the correct function. The other code I shared still applies. If you can’t get that to work, please share the activity as it’s easier to make adjustments that way. :smile:

I’ve found that this does cause issues if you have an undefined output (e.g. using tanx instead of sinx and your list in increments of pi/4). Here’s how I changed your C_{heck} to avoid undefined values breaking it.

Note: I used the square root function as an example. C_{heck2}=0 but C_{heck} is okay.

Thanks for pointing that out. That thought didn’t cross my mind!

https://teacher.desmos.com/activitybuilder/custom/60900df9ff9f48046a624247

Here’s the graph I’d use for Slide 2. I’m guessing there’s a way to do it with pattern checking, but I’m not there yet.

For dashboard correctness, use this in the input:

midline= Sketch6.number(`m_{id}`)=2
amplitude= Sketch6.number(`a_{mp}`)=3

correct: midline and amplitude and this.submitted

If you just wanted the equation f(x)=3sin(x)+2 you could just change g(x) in my AutoCheck Functions graph to this equation. (My example in this post will also allow horizontal translations.)

You might one to explore the activity I made. Slide 20 was fun to program. I belive you might want to reuse some of my slides