Graphing a function transformation in f(x) notation?

Is it possible to graph an input in function transformation notation?

For example, I gave a random piecewise function displayed that’s defined as f(x), and a transformed function, such as y=2f(x-2).

In “calculator” mode, it’s possible for students to enter a function using f(x) as a reference. Is it possible to do this as an “input”? I haven’t had luck with either simpleFunction or even using differenceFunction.

1 Like

I have only ever managed to do this using rawExpression which is generally not a popular method; I’m hoping there is an answer that doesn’t involve it.

Thank you for your help! It turns out I was successful, but only using rawExpression. I’m unclear on what the problem is with that as a solution, but would love something cleaner.

For anyone else who has a similar question:

In my CL script for the graph, I used:

rawExpression("g"): equation1.latex

And then in the graph itself, I had to have a line that just graphed g, not g(x) or y=g or anything similar. That may be obvious to others, but had me stumped for a bit.

Not sure what the exact desired outcome is, but you could use a composition of functions defined in the graph itself to create this effect. Granted, the students would be typing “2x-2” instead of “f(2x-2)” in this example.

Would you be willing to share the activity in which you did this? I would really appreciate it!!

It was long enough ago that I’m not sure exactly what activity I was using, but it’s possibly this one because I had them graph transformed functions. Word of warning, it’s in the “old” CL format, so not sure if everything works right.

Thank you so much. Unfortunately the “Copy and edit” option is greyed out for me, with the message “This activity can’t be copied because it contains a deprecated feature.” Your activity does exactly what I want to do (basically replicate the “What’s My Transformation” activity, but modify it for my own purposes) but I don’t have the CL chops to do this on my own.

Again, thank you so much for your effort. I’ll work with some of the clunkier versions I found elsewhere, unless there’s a different way to share your screen 7, for example.

Well that I can help with!

I made a copy and tweaked things (template here)

To make it your own, you should be able to copy/paste slides. I usually just change the number on the graph and input (to be Graph1, Graph2, etc) and then go into the CL and update accordingly. I think I labeled the contents of the graphs themselves clearly so you know what to edit.

Unfortunately, it’s not self-correcting, as I rarely bother with that (I have <10 kids per class).

Actually fairly easy (without even looking at the code) to self correct this. In the graph CL, add:
function("g"): simpleFunction(inputName.latex)

Then, in the actual graph, something like this:

You just need to access the graphName.number("C") to use for conditional feedback, or just to get the checkmark:
correct: this.number("C") = 0

Ali, you have outdone yourself… But I think Desmos has outdone both of us. The “copy and edit” feature is greyed out on my end even on the link you provided here, and the ability to paste slides is nil, zero, nada. Grr.

I would really like to see what you did to create this… If you are willing to contact me directly (and share your time) that would be great. If not, I understand. My email is

Thank you again for everything!

You might check out this from Desmos @Alison_Signorotti:

Thanks, but that doesn’t have the f(x-2) element as an input allowing students to shift a graph… Or am I missing something?

Daniel, we’re not using simple functions here, we’re using rawExpression (which, admittedly is brittle and depreciated, but there isn’t a nice clean replacement) to write expressions in the form y = af(x-h)+k. Comparing to a simpleFunction("g") doesn’t self-correct.

For reference, I’ve read a lot and there’s not a good replacement for rawExpression in this case. (The parseEquation("x","y") is good for implicit functions, but that’s not what we’re doing here.) I’ve tested out various people’s suggestions when the question comes up, but the solutions tend to be good for things like conics, not graphing using function notation specifically.

What I had done (and tends to work, because it’s simple):
In the CL for the graph:

rawExpression("g"): Transformed_Equation1.latex

In the graph itself,

f = some random piecewise function
y = -f(x+2)-3

Unfortunately, it seems that rawExpression IS the deprecated code that’s not allowing it to be copied. (Sorry, I totally brain-farted the f(x) notation need.)

I made a separate thread for it, but I think I may have a solution for you. Here you go: