1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Round down for n

  1. Jun 21, 2013 #1
    I have 3 functions in n which are rounded down to the nearest integer, and I need a closed-form way of writing each function. n will be a positive integer in all cases.

    (Let the notation RD(f(n)) denote rounding-down the value of f(n) for a certain n, to the nearest integer.) What I have found with each function is that f(n)=RD(f(n)) for all even values of n, and RD(f(n))=f(n)-x where x is a fraction which varies from function to function but, for a given function, is constant across all values of n. For the first function, x=0.5, for the second, x=0.75, for the third, x=0.25.

    Knowing this, how can I rewrite RD(f(n)) as a closed-form function, k(n), of n and f(n)? The key lies in finding some g(n) so that g(n)=-1 if n is odd and g(n)=0 if n is even; then I could write k(n)=RD(f(n))=f(n)+g(n)*x.
  2. jcsd
  3. Jun 21, 2013 #2


    User Avatar
    Science Advisor

    Can't you use the "floor" function, [itex]f(x)= \lfloor x \rfloor[/itex] which is defined as "the largest integer less than or equal to x"?
  4. Jun 21, 2013 #3
    No, that's the very definition of my problem. I need a [itex]k(x)[/itex] such that [itex]k(x) = RD(f(x)) = \lfloor f(x) \rfloor[/itex] to use your notation.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook