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.

I'm looking for a formula that, given a linear $x$ input, would yield values of $y$ in a "stairs" shape so to speak, in such a way that as the value of $x$ grows higher, the difference between each step is bigger, and it also takes longer to reach the next the step, as this graph (hopefully) illustrates:

enter image description here

As you have probably guessed by now I'm not a mathematician, but I'm fairly sure this has an easy solution. I've been playing around with modulus and powers but I couldn't quite get the graph above so far.

Edit: Graph updated.

share|improve this question
    
Do you need all the points (i.e. the where the vertical meets the horizontal) of each step to lie on a straight line? –  Chuck Aug 12 '12 at 12:52
    
@Chuck correct. For instance, a subset sample of $y$ values could look like: [2, 2, 2, 2, 5, 5, 5, 5, 5, 8, 8, 8] etc –  Mahn Aug 12 '12 at 12:55
    
Graph updated, silly me. –  Mahn Aug 12 '12 at 13:00
    
For a linear stepcase, we would assume that without a "floor" function, it could be simplified to the form of $y=kx$. Then using $f(x)$ and $f^{-1}(x)$ simultaneously could achieve this effect. –  FrenzY DT. Aug 12 '12 at 13:11

3 Answers 3

up vote 5 down vote accepted

My first intuition is $y=2^{\lfloor\log_2\,x\rfloor}$. It's very pretty though:

plot of 2^{\lfloor\log_2\,x\rfloor}

share|improve this answer
    
@J.M. Thanks for the beautified formula. –  FrenzY DT. Aug 12 '12 at 13:03
    
Thank you very much, this gets very near what I was after, and with a couple of variables added to the mix it works wonderfully. –  Mahn Aug 12 '12 at 14:53

It might be too steep for what you want though.

$\large y = \left \lfloor \frac{-1 + \sqrt{8x+1}}{2} \right \rfloor$

Plot

A Plot of the function

share|improve this answer
    
A bit too step indeed but great approach nonetheless, I will remember this formula in case I need it in the future, thanks! –  Mahn Aug 12 '12 at 14:56

Writing $[x]$ for the integer part of $x$, how about $y=[\sqrt x]^2$?

Plot

The plot

share|improve this answer
    
I think that in this case, the width of staircases is growing at a fairly slow pace (slower than exponential). But it fits the given picture better. –  FrenzY DT. Aug 12 '12 at 13:04
    
Thanks for adding the plot! –  Gerry Myerson Aug 12 '12 at 13:33
    
np :) :) double smile for char[15+1] limit –  FrenzY DT. Aug 12 '12 at 13:39
    
Great answer, I can't accept two answers but this one also came close, you have my upvote. –  Mahn Aug 12 '12 at 14:54

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.