# Reverse of a log-based f(x)?

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

-
Hint: what is $\ln(f(x))$? –  Robert Israel Jan 24 '12 at 18:14

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)}$$

-
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.) –  Dennis Jan 24 '12 at 19:49