Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|cite|improve this question
Hint: what is $\ln(f(x))$? – Robert Israel Jan 24 '12 at 18:14
up vote 0 down vote accepted

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

share|cite|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.