Randomizing values for a function

I am trying to write a random number generator for a simple function: ax^b. I found an example that is similar and I am trying to copy the Computation Layer but when I go to preview it says “undefined”. I think it has something to do with “numericValue” for my c =.

Here’s the coding:

You’re right, the numericValues are causing a problem. It looks like you just want c and d to be latex, where numericValue is meant to have an output of a number instead of an expression. Does something like this look like what you’re looking for? The answer matching isn’t very good because it’s looking for exact latex matching, so if you want a better method, let us know! I also adjusted your random numbers to avoid zero, but if you’re fine with it, use what you had before. :slight_smile:

This is great! Thank you.

However, when I was testing it, it keeps telling me to “try again” when it should be showing correct. Not sure how to fix this.

Note: I get correct when I type the answer with the operations, ie: 3*4x^3-1
but I don’t want that as the answer, I want the simplified answer: 12x^2

My fault. The previous link has been updated and should be correct now.

Thank you! That works!!!