# "Match My Function" using function notation

**URL:** <https://cl.desmos.com/t/match-my-function-using-function-notation/1487>\
**Category:** Examples\
**Tags:** dashboard, patterns\
**Created:** [September 12, 2020, 4:13pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487 "2020-09-12T16:13:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 12, 2020, 4:13pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/1 "2020-09-12T16:13:11Z")

</div>

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`.

> **["Match My Graph": Transformations in Function Notation • Activity by Daniel...](https://classroom.amplify.com/activity/5f5fdf135926eb2ef76ddf4f)**
>
> by Daniel Grubbs

(Updated link with dashboard checkmark functioning)

---

<div class="post-metadata">

**Author:** ![Ali\_Lauer](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ali_lauer/32/226_2.png) [@Ali\_Lauer](https://cl.desmos.com/u/Ali_Lauer)\
**Post date:** [September 15, 2020, 12:05pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/2 "2020-09-15T12:05:41Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![JAC9186](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jac9186/32/5018_2.png) [@JAC9186](https://cl.desmos.com/u/JAC9186)\
**Post date:** [September 29, 2020, 6:45pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/3 "2020-09-29T18:45:23Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 29, 2020, 8:07pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/4 "2020-09-29T20:07:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JAC9186](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jac9186/32/5018_2.png) [@JAC9186](https://cl.desmos.com/u/JAC9186)\
**Post date:** [September 30, 2020, 1:27am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/5 "2020-09-30T01:27:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [September 30, 2020, 6:28am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/6 "2020-09-30T06:28:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JAC9186](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jac9186/32/5018_2.png) [@JAC9186](https://cl.desmos.com/u/JAC9186)\
**Post date:** [September 30, 2020, 1:31pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/7 "2020-09-30T13:31:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![SandiG](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sandig/32/1895_2.png) [@SandiG](https://cl.desmos.com/u/SandiG)\
**Post date:** [February 16, 2021, 3:21am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/8 "2021-02-16T03:21:17Z")

</div>

@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…

> **[graphs to eqns - transformations (absolute value explicit function definition)...](https://teacher.desmos.com/activitybuilder/custom/602b369b2374fe0c77157f5e)**
>
> by Glenn Laursen

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 16, 2021, 4:05am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/9 "2021-02-16T04:05:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 16, 2021, 4:13am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/10 "2021-02-16T04:13:26Z")

</div>

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

> **[Transforming Square and Cube Root Functions (Part 2) • Activity Builder by...](https://teacher.desmos.com/activitybuilder/custom/6011d18c5ff19547f6fbfcf8)**
>
> by Daniel Grubbs

---

<div class="post-metadata">

**Author:** ![SandiG](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sandig/32/1895_2.png) [@SandiG](https://cl.desmos.com/u/SandiG)\
**Post date:** [February 16, 2021, 4:29am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/11 "2021-02-16T04:29:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 16, 2021, 8:07am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/12 "2021-02-16T08:07:06Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![SandiG](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sandig/32/1895_2.png) [@SandiG](https://cl.desmos.com/u/SandiG)\
**Post date:** [February 16, 2021, 4:44pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/13 "2021-02-16T16:44:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [February 16, 2021, 5:23pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/14 "2021-02-16T17:23:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![B\_Kirk](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/b_kirk/32/582_2.png) [@B\_Kirk](https://cl.desmos.com/u/B_Kirk)\
**Post date:** [March 17, 2021, 6:38pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/15 "2021-03-17T18:38:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 18, 2021, 5:09pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/16 "2021-03-18T17:09:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![B\_Kirk](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/b_kirk/32/582_2.png) [@B\_Kirk](https://cl.desmos.com/u/B_Kirk)\
**Post date:** [March 18, 2021, 5:46pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/17 "2021-03-18T17:46:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [March 18, 2021, 5:49pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/18 "2021-03-18T17:49:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nemoyatpeace](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/nemoyatpeace/32/33_2.png) [@nemoyatpeace](https://cl.desmos.com/u/nemoyatpeace)\
**Post date:** [November 2, 2021, 9:20am UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/19 "2021-11-02T09:20:53Z")

</div>

@Daniel_Grubbs thanks for connecting me with this thread! I looked at what you had done and got excited. Then I realized that you are not actually graphing what is typed, but working out the values of a, h, and k based on the output that comes. I wish I could just assign it to a function to draw the graph, I’m trying to include horizontal stretching and flipping as well. You mentioned something about beta patterns, but I have no idea what that is, and can’t find the documentation for it.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [November 2, 2021, 3:50pm UTC](https://cl.desmos.com/t/match-my-function-using-function-notation/1487/20 "2021-11-02T15:50:17Z")

</div>

Well, by defining the a, h, and k you can define a function for graphing within the graph:

```auto
h(x)=af(x-h)+k

```

The Desmos calculator accepts function form, but you can’t do it through CL, which is why I defined those variables.

Edit: It is graphing, but not directly. I’m kind of tricking the CL into recognizing function notation by defining those variables, which is why the other transformations become difficult because you can’t really solve for them. I still haven’t messed with pattern matching for this in particular yet.

[Next page](https://cl.desmos.com/t/match-my-function-using-function-notation/1487.md?page=2)
