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 want to design a function that satisfies the following:

generally speaking, $f(x) = y$

$$f(5.51) = 1$$ $$f(95.31) = 200$$

How can I go about designing the function to satisfy these requirements?

share|cite|improve this question
Hmm, what kind of shapes would you like it to be? Is it convex/concave? Polynomial? Any symmetries? Or would you like to fit the data into certain functions? [Always hit <kbd>ENTER</kbd>...] – Frenzy Li Aug 20 '12 at 13:40
Next time please use TeX formatting as well as refraining from possibly offensive language. – nbubis Aug 20 '12 at 13:41
Sure thing. I'd like this function to be exponential, or at least that general shape. – Dan Aug 20 '12 at 13:42
The trouble is, the two "rules" f(5.51) = 1 and f(95.31) = 200 are obviously useless when x is not 5.51 or 95.31. Do you want us to guess what y is when x = 5.5? There are too little data points to use (non-linear) regression analysis‌​. – William C Aug 20 '12 at 13:48
I seem to be confusing people about the purpose of my question. Basically, I'm designing this function so I can visually lay out elements in a web form such that they are aesthetically pleasing as well as precisely fitting numerical requirements. Whether or not that knowledge will please or enrage you is beyond me. – Dan Aug 20 '12 at 14:01
up vote 2 down vote accepted

If you want a function of the form $f(x)=a e^{bx}$ then simply solve for $a$ and $b$ using your data points.

If you want a polynomial function of degree $n$ then you'll need $n+1$ data points. With two data points, you get a polynomial of degree 1 (at most).

share|cite|improve this answer
Awesome. That's great. Unfortunately I can't vote this solution up because I don't have enough reputation. I'm also now wondering how could I do the same thing using a polynomial? – Dan Aug 20 '12 at 13:48
@Dan, I've edited my answer. – lhf Aug 20 '12 at 13:50
The last statement sounds good, y=mx+c will suffice here, (m,c are to be resolved from the given two conditions). – lab bhattacharjee Aug 20 '12 at 13:51
Ah, cool. Let's add $$f(40) = 10$$ – Dan Aug 20 '12 at 13:52
I mentioned "the given two conditions". With n given conditions, we need n degree polynomial, right? – lab bhattacharjee Aug 20 '12 at 13:55

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.