How to verify if an equation is exponential?

Students enter exponential equations in a table based on the given transformation of the parent y=2^x.
For example - steeper than the parent - students enter an equation of the form y=a * 2^x

To verify it is correct, the cl should check if |a| > 1 and if the equation is exponential. How could you verify if it is exponential? The table shows correct for entering y=8. Is there a simple way to check?

Here is my code.
cellDisableEvaluation(1,2): true
cellDisableEvaluation(2,2): true
cellDisableEvaluation(3,2): true
initialCellContent(1,2): y=
initialCellContent(2,2): y=
initialCellContent(3,2): y=

a1 = ${parseEquation(this.cellContent(1,2)).rhs}
a2 = ${parseEquation(this.cellContent(2,2)).rhs}
a3 = ${parseEquation(this.cellContent(3,2)).rhs}

cellContent(1,3): when f1.evaluateAt(0) > 1 #steeper
when a1 = undefined “”
otherwise “:x:

cellContent(2,3): when f2.evaluateAt(0) < 1 and f2.evaluateAt(0) > 0 #Wider
when a2 = undefined “”
otherwise “:x:

cellContent(3,3): when f3.evaluateAt(0) < 0 and a3 = -2^{x} #reflection
when a3 = undefined “”
otherwise “:x:

tblCorrect = (this.cellContent(1,3) = “:heavy_check_mark:” and this.cellContent(2,3) = “:heavy_check_mark:” and this.cellContent(3,3) = “:heavy_check_mark:” )

Appreciate your help

Thank you

IF all you’re doing is ab^x then you could simply verify that the ratio of the input to the original is equal to a.

However I’d recommend doing the same thing but with deriviatives to ensure the code is more extensible to other transformations too.

Thank you, I guess using the derivatives is best option here. I have to look into coding the derivatives and unfortunately time is not on my side. Any help with this would be great. If not, no problem I can understand.

Thank you

This will check if latex contains an exponential anywhere in a the latex, just change this.latex to your individual cells. You could check that the whole entry has a more specific format though.

p= patterns
exp = p.contains( p.exponent(p.number,p.literal(`x`)) ).matches(this.latex)

You can use patterns to do this more simply, especially since you have a simple pattern of ab^x. You can then extract a and b and just check their values as needed, as well as verify that the student input is in the correct exponential form. Here is an example:

Is p.contains new? I haven’t used that before.

As far as I know it’s been around a while. There’s also p.anyOf.

Upon searching, I see a post as early as Feb 2022 containing p.contains.

p.contains( p.contains ).matches( February 2022) = true

Huh… thanks. I’m aware of anyOf, but somehow I never noticed contains.

with deference to using patterns for this, i’d recommend it’s not the best tool, for two reasons:

  • since the parent function is already given as an exponential we have a comparison basis already in hand
  • checking if a function is a specific type means the code isn’t extensible to other types of transformations, basically the code is more brittle

the second issue is perhaps more imporant than the first.

It worked!! Thank you so much for helping a teacher!! Much appreciate your help.

For now, I am just checking if it has an exponential in the latex. I will try to match the whole entry for y = a b^(x-h) + k on another slide.This is good and usually my students will tell me if the code breaks.

Thank you again

Thank you for the sample pattern, I will try using it.


here you go: exponential check • Activity Builder by Desmos

I did not know the graph component could be used to compute the ratio. I was thinking of coding in the math component and got stuck. I learned something new. Thank you so much!