Checking equations of horizontal and vertical lines

I am trying to develop an activity to teach slopes of perpendicular lines. I have several slides where I show students a linear function and then ask them to write the equation of a line that is parallel or perpendicular to the line shown. I am using simpleFunction(input.latex, “x”) to make a graphing component show the line that the students enter.

I want to include horizontal and vertical lines in the practice set but simpleFunction does not seem to graph a horizontal line if I include the “x”. When I remove the “x”, then simpleFunction graphs the line, but it does it if the student enters the full equation, or just a value. I want to make sure that the student knows a horizontal line is y=2 and not x=2, which seems to be a common mistake. How can I graph a horizontal line, but only if the student enters “y=”?

I have a similar problem with vertical lines. I am using simpleFunction(input.latex, “y”) and then graphing x=f(y) but this shows the vertical line as soon as the student enters a number without requiring them to enter “x=”.

One way to check for correct student input is to add an on/off switch and check that the string matches equations like y=5, x=7, or y = 2/3x-8. You can use this activity for horizontal, vertical, or slope-intercept lines. Note that the student must enter the string exactly or they won’t see the graph, so no spaces capital letters.

I would love to see your activity of vertical and horizontal lines. I am working in an activity that involved horz and vert asymptotes. Thanks, Burton

Here’s a method for graphing using xyLine in the graph CL:

input=`${yourInputName.latex}`
myLine=xyLine(input)
function(`f`): when myLine.isVertical simpleFunction(`1/0`) otherwise simpleFunction(input)
function(`g`): when myLine.isVertical simpleFunction(input,"y") otherwise simpleFunction(`1/0`)

In the graph you’ll need:

y=f(x)
x=g(y)

The link works again. It’s not a whole activity, but rather just a way to check if the line is typed exactly. Checking exact typing is not typically recommended on this support site, but there are times when I expect to see the line written in a particular form, so I intend to check the exact string.

It can get complex, but the situations where you can’t use an alternative to latex matching are limited. Requiring terms be in a particular order, and domain/range in interval notation are a few of those where latex or string matching is the best option.

@Susan_Lauer Hi! I literally have the same things that you do in the CL and it will NOT graph the horizontal line on slide 7. I want them to be able to graph the horizontal asymptote by plugging in the equation. Can you help me please?

Also, @Daniel_Grubbs or Susan, would it be possible for students to be able to enter the equation for the asymptote and enter values into a table to graph points on the same graph? It wasn’t working for me so you can see that I separated them. Any advice is helpful. I am trying to get this together for the morning.

Thanks!

I’m not sure if you meant slide 7 or slide 8, but I noticed on slide 8 that you wanted a horizontal asymptote, so I looked at that one. I see that you had the same restriction on both functions in the graphing calculator (\left\{s_{howf}=1\right\}). I think you probably wanted one of them to be \left\{s_{howh}=1\right\}?

@cwinske … yes slide 8. I forgot that the screen I was looking at was showing the preview without the draft being saved.

Honestly, I copied that straight from another activity where it was working and all of it looked the same. That is why I am so confused. If you have a better way to do it, I’m ready to learn. I would like to be able to have them graph the asymptote by plugging it in and plot points from the x/y table on slide 9 on the same graph. I don’t know if I can do that.

Also, I don’t know what I am not seeing, but those restrictions look the same to me.

I think that was @cwinske 's point. h(x) should have showh not showf.

Yes, you should be able to do the table on the same slide, using the code in slide 9’s graph CL in slide 8’s CL (minus the error of “graph1” instead of your component’s name “g1”, but you won’t need the background if you combine slides anyway).

Also instead of three different functions you could use one:

function(`f`): parseEquation(input.latex).differenceFunction("x","y")

And in the graph:

0=f(x,y)

@Daniel_Grubbs hahahaha looking at the computer all day, I didn’t catch the subtle difference. I see it now that I stepped away.

You saved the day once again. Thank you so much! That simplified equation is exactly what I needed. :grin:

1 Like