# "Match My Function" using function notation

Thought I’d put this in it’s own thread. I made a way to check for transformations in function notation basically by ‘tricking’ Desmos into thinking `f` is a variable, and then calculating student values of `a`, `h`, and `k`.

(Updated link with dashboard checkmark functioning)

Oh, excellent. I’m going to dive deeper with this, but I notice you’re also able to get away from the `rawExpression` that is apparently “broken”.

@Daniel_Grubbs, this was really cool. Thanks for thinking through that and sharing with all of us.

One modification I made was to get rid of the parseEquation in favor of accepting an expression like f(x)+1 to graph. It wasn’t as intuitive to me that you wanted g(x)= until I peeked under the hood of your CL

eq1=simpleFunction(Input.latex,“f”,“x”)

One thing I think I’ve noticed here is that it seems like I can’t create horizontal stretches/compressions. Is that right, or am I missing something?

Just a word of caution for anyone who’s using this for transformations.

It’s intended to be a transformation in function notation, so the function `f(x)` (in blue) is to be mapped to `g(x)` in red (though it shouldn’t matter if you use `h(x)`). I had to use parseEquation because simpleFunction alone wasn’t accepting function notation if you enter `g(x)=`.

The answer for the example should be:
`g(x)=-f(x-1)+7`

It should work for stretches and compressions if using function notation.

Thanks for setting me straight. I appreciate the example and initialLatex in there now

I am attaching a video of what I see when I try to enter -f(x) and f(-x). I see the same thing (a reflection across the x-axis), which I was not expecting. I can get vertical stretch/compression to appear, but I don’t see horizontal stretch/compression. Am I missing something here?

Sorry, yes, you’re right. When I made it, it was helping someone looking for the form:
`g(x)=af(x-h)+k`

There may be a way to work in the horizontal stretch/compression. I’m not sure how at the moment.

Thanks for looking into that with me. This manipulation to get function notation accepted is very helpful. Thank you for running with the idea and sharing out!

@Daniel_Grubbs I’m trying to do the reverse of what you posted (also, whoa), let the kids move the vertex around, test their input against it.

Right now my script grabs `h`, `k` from the graph and (is failing to) make functions that I can test at two separate points using simpleFunction() and evaluateAt().

My debugging tells me that my h, k values are undefined, but that’s the point that’s getting dragged around in the graph…

*edit: `anseq` doesn’t like having `|` in the `simpleFunction()`. How could I indicate absolute value without that? `\abs`, `\mod`, `\mid`, & `\vert` don’t work either…

Since the CL isn’t playing nicely for you, why not do all your calculations in the graph? Since `anseq` is basically g(x) in the graph, just make variables there equivalent to g(0) and g(1) and reference those in your CL.

1 Like

Also, I did this with my students recently, square root functions instead of absolute value, but maybe you could tweak it to your needs.

Thank you!! That worked, I was wrestling with that for way too long!

`Correct:` doesn’t quite work for these for some reason. It marks X if wrong but if correct it marks dot instead of check.

Just FYI, you can reference numbers from graphs directly in other components. You don’t need to make a variable in the CL first. You have ans1 and ans2 in your graph CL, which you then reference for ansval1 and 2 in your math input. You can be more direct:

``````ansval1= graphref.number(`t_{est1}`)
ansval2=graphref.number(`t_{est2}`)
``````

Thanks for the tip. Yeah, that screen is really bloated with stuff – My increasing anxiety and bad debugging attempts.

It takes practice. I’m reusing some older activities I’ve made and find lots of errors and inefficiencies.

Hi Daniel-

Have you put any thought into how you might modify your activity here to accommodate for a horizontal stretch/compression? I’ve spent the last 45 minutes thinking about it, and I’m not sure that it is possible, at least not with how you’ve defined a, h, and k.

I’ve tried to figure it out. There’s just too many variables interacting to solve for b. Perhaps the beta `pattern` constructors in the CL documentation might work, but I haven’t fiddled with those yet.

Spending a little time fiddling with it now, but not getting very far. The syntax is very mysterious!

Usually for debugging, I like to make a table with different code checking to see results of different math inputs.

1 Like