Find the opposite of a numeric value (Translations of Parent Functions)

I am creating an investigation for students to translate and transform parent functions. I was able to get the correct equation to show up when the horizontal translation was a positive h value. However, I would like the equation to read +h for a negative h value instead of - -h. Thank you!

There is no shortcut. I’ve built graphs like this before and the only way I’ve found is to use conditional statements in the graphing calculator. Specifically, the point you use to display the equation should have a conditional attached to it in the graphing calculator, such as
{h<=0}. This will cause the equation to disappear when h>0
In the same location (i.e. a point with the same coordinates), place a different point with a different label that is in the form y=a(x+h)+k and attach the condition {h>0} to that point.

So, based on the value of h, one equation will disappear and the other one will appear. Clunky, but I don’t think there is another solution.


Encountered this problem a lot early on in my desmos adventures, my work around is to store variables in a note and create a new variable using strings for printing. Each printed variable stems from basic dichotomy (or trichotomy) to each component part of the equation.

See the component question7to8 in the activity below for what I’m talking about in detail:

But essentially all I do is pull the variables and then create a “print variable” version of them for what I want it to look like

a=1 (or usually: graph.script.a)
ap= when a=1 “” when a=-1 “-” otherwise “${a}”

ditto for the operation between terms with just printing an empty space when following term is negative as the latex look of it just looks like a subtraction.

sign1 = when b<=0 “” otherwise “+”

I then assemble it into a final printed equation within latex ticks and include any relevant parts and display as content.

equation = “${ap}${sign}${etc}${etc...}

This works better in anything with lots of terms or coefficients as the number of permutations grows exponentially with each added term/coefficient


1 Like

I appreciate both posts. I think it is now figured out. Thanks!

Thank you for sharing the final result! This is amazing and will be very useful for my students next week!