I have a general quadratic in the form of ax^2 +bx + c with sliders. I also have the discriminant, b^2-4ac in a separate expression. I would like a note to change what it says based on 3 conditions: discriminant < 0, discriminant = 0, and discriminant > 0 which is based on the position of the sliders.

# Write Note based on Value of Equation (Discriminant)

Welcome!

In the note component, you just need to set the content to have some conditionals based on the value of the discriminant. Here’s an example:

Wow,

That is great, thank you so much! In addition to the scripting, you have shown me how to make custom sliders…so cool, even though I don’t understand everything, I will be able to follow your example.

Could you explain why the sliders are 1/5 a, b, c and what the `a=${a}`

, etc is doing?

For the points on the sliders, I needed the x-values of the coordinates to correspond to the values of a, b, and c from the quadratic function. Because of where I placed the horizontal lines, the correspondence was a linear relationship that happened to be 1/5a-6. If I moved those sliders to another quadrant (or even change their length), that relationship would change.

As for `a=${a}`

, this is to show the label of the a-value in the quadratic function. Since the value changes when the slider moves, putting ${a} in the label will show the number as it changes. You could also use that notation in the note component for dynamic values. I believe I did that for the discriminant value in the note.

Thanks so much for your help. One other idea that I thought would be nice would be to have the equation, ax^2 + bx + c dynamically changing with the slider(s) in either the note or the heading. Is this complicated?

I updated the activity linked above to include the equation in the note, although it’s not very elegant if the variables are less than 1.

Check out slide 1 of this activity for something that looks a bit nicer.

Several great ideas here, thanks. I only moved the position of the equation to the other side of the graph.

Mike