simpleFunction() and horizontal lines

I have been trying to use simpleFunction() to create a horizontal line. It doesn’t seem to allow that.
But in the calculator, you can do f(x)=3 and it gives you a horizontal line.

I’m working on a visual equation solver and want the students to enter both sides of the equation in the table. Then, visualy, the student could place a point on the intersections.

The only way I can figure out to do that is to have an input of 3*x/x. That does create a horizontal line at 3.

Any help would be great.

Can you share an example of what’s not working specifically? Here’s a very simple example using simpleFunction, which plots horizontal lines when you input “3”, or “f(x)=3”

I did test in with an expression input but if I use a table as the input it doesn’t.

Enter 3 in either right side or left side row of table in this example.

It’s an issue in the graph screen itself. You have just got the line f_1(x) which generally works if you put an x in your expression.

Solution: change the first two lines to say y = f_1(x) and y = f_2(x)

2 Likes

I am having the same problem. I do not understand what you are suggesting.

In the CL for the graph component, type this code (assuming the input component is named input):

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

If you are using a table instead of math input, try this (this assumes the function is being typed in row 1 column 1 and the table component is called table):

function("f"): simpleFunction(table.cellContent(1,1))

The part that was referenced above should go in the actual graphing calculator.

2 Likes

Thank you very much!

I’m trying to work on this too. But I still seem to be missing something. On Screen 5, I would like the students to type y = 600 and see the horizontal line. However, I have to type y = 600 + 0x in order to make that happen. What am I missing here?

Try this in the graph component
image

Oh geez…thanks for taking the time to find that. :woman_facepalming: