0
$\begingroup$

I am attempting to create a function, f(y) that can reverse my existing function, f(x).

x_min = 150 x_max = 750 y_min = 10000 y_max = 80000  for x between x_min and x_max, y = f(x) {   top = log(y_max)   bottom = log(y_min)   scale = (top - bottom) / (x_max - x_min)   return E ^ (y_min + (scale * (x - x_min))) }  for y between y_min and y_max, x = f(y) {   ??? } 

For the time being, I am using a simple "searching" function that calls f(x) multiple times for different values of y until it finds the answer. I would like to be able to directly calculate f(y).

  • 0
    Hint: what is $\ln(f(x))$?2012-01-24

1 Answers 1

0

You are asking, given $ y = E^{y_0 + \frac{t-b}{x_1-x_0}(x-x_0} $

solve for x. See help on how to use the formatting.

Also, you are using the term function incorrectly - $f$ does not change its form just because you name the parameter differently.

To solve for x, first use the logarithm.

$ log_E(y) = log_E(E^{y_0 + \frac{t-b}{x_1-x_0}(x-x_0)}) $

$ log_E(y) = y_0 + \frac{t-b}{x_1-x_0}(x-x_0) $

and from there you can easily solve for $x$

Note that $log_E$ is the logarithm with base $E$

$ log_E(y) = \frac{log(y)}{log(E)} $

  • 0
    For the sake of completeness, the answer is $ x = x_0 + (log_E(y) - b) (\frac{x_1-x_0}{t-b}) $ (Minus $b$ and not minus $y_0$, because of a typo in my initial post.)2012-01-24