Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This is probably very simple for some of you, but I can't for the life of me get something that works reliably. Given any positive number, $x$, and a positive high and low value $(h, l)$ what kind of functions $f$ are there such that $l\leq f(x)\leq h$?

share|improve this question
1  
I'm not sure that I understand the question. Are you looking for an expression that can be converted to a boolean value indicating whether or not x falls within the specified interval? –  Andrew Jun 15 '12 at 15:43
    
What are the conditions on the function you are loking for? The answer gives one possible solution; another would be $f(x) = (l-h)e^{-x} +l$. Technically, the constant function $f(x) = l$ would work too... The right function depends on the exact problem you are trying to solve. –  Johannes Kloos Jun 15 '12 at 15:49
    
@Andrew no, I'm trying to perform a function on x so that it falls within the interval. –  scottm Jun 15 '12 at 15:55
    
@scottm: I have edited your post. Does it match what you are trying to ask? –  Cameron Buie Jun 15 '12 at 16:30
    
@CameronBuie yes, thanks –  scottm Jun 15 '12 at 16:31
show 1 more comment

3 Answers

As an easier-to-compute alternative to caozhu's arctan solution: $$ x\mapsto h - \frac{h-l}{x+1} $$

share|improve this answer
add comment

Say $l=0, h=1$ then $0\le \sin^2(x)\le 1$.

share|improve this answer
    
And of course, you can scale and shift this for arbitrary $l,h$.... –  Cameron Buie Jun 15 '12 at 16:27
add comment

I guess what you want is actually bijection between $(0,\infty)$ and $(l,h)$. Here's a possible way. For $x\in (0,\infty)$, Clearly $\frac{\arctan x}{\pi/2}(h-l)+l\in (l,h)$ is a bijection.

share|improve this answer
add comment

Your Answer

 
discard

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.