Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Generating monotonic decreasing functions

  1. Dec 20, 2008 #1
    OK, this is an odd request, but is there some way or existing list of monotonic decreasing functions? The limitations I have are:

    - f is monotonic and decreasing.
    - f(0) = a, a is a real constant; f(1) = 1 ( or simply, passes through (0,a) and (1,1) )
    - Cartesian equations, most preferably.

    I thought it would be useful if there was such a thing (so there probably is), even if it's a software, like those curve fitting ones which have a predefined set of functions, just that here I'm (edit: interesting -> interested) in threading through the exact points. Reason being, I've written a code that does wonders with any input function for problems in fluid dynamics, but I'm having trouble thinking of inputs to test it out with when I have these limitations. Here's two fairly easy ones which I have thought of so far:

    y = (1-a)(x-1) + 1
    y = (a-1)(-10x^3 + 15x^4 - 6x^5) + a

    Thanks in advance!
    Last edited: Dec 20, 2008
  2. jcsd
  3. Dec 20, 2008 #2
    Here's a family of simple ones...

    [1/(e-1)](a-1)(exp(-x^n+1) - 1) + 1

    Plugging in x = 1, we have that exp(-x^n+1) = exp(-1+1) = exp(0) = 1, so the first term drops out and leaves only the trailing +1.

    Plugging in x = 0, we have [1/(e-1)](a-1)(e-1)+1, and we are left with (a-1) + 1 = a.

    n can be any number... in fact, the only restriction is that it be positive. Does not even have to be an integer, even though that's how I envisioned it when I came up with it.

    Is that what you're looking for?
  4. Dec 20, 2008 #3

    a*cos[ (pi/2) x/(x+1) (4/pi)arccos(1/a)]
  5. Dec 20, 2008 #4
    Yes! Those meet the requirements that I'm looking for! Thanks aplenty!

    I have to ask, is there a general way that you come up with them... or is purely based on your intuition (*cough* both of mine are polynomial functions ><;)?
  6. Dec 20, 2008 #5

    [(1-a)/ln(1/2)]ln(1/(x+1)) + a
  7. Dec 20, 2008 #6
    Well, I do have a method.

    Basically, I think of the function I want to make work. So for my first example, I thought "exponential function". So we have


    Next, I said, let it always equal 1 at x = 1. So I shift one to the right...

    exp(-x + 1)

    Now, I know I need to scale it so that f(0) = a. So, to do this, I need to be able to multiply the whole thing, stretching it out. But to do this correctly, I must subtract by one so the point (1, 1) is "anchored" at (1, 0)... otherwise, I'll lose it. Of course, I'll have to add one back to the end result to have it go through (1, 1) again. So I have...

    c ( exp(-x + 1) - 1 ) + 1

    At this point, c can be found by plugging in x = 0 and demanding that the whole thing equals a. That leads to me final answer. I also noticed that there could be any power on the x without affecting anything (though this is luck, and I'm not even 100% sure it works for any n).

    The others worked the same. You've just got to start with a function - any function - and figure out how to make it do what you want anywhere you have constraints.
  8. Dec 28, 2008 #7
    Oh crap, I realized that I must have closed my browser along with my reply and plain forgot to thank you for sharing your method. My code worked flawlessly with your examples, and I've gotten a hang of the method.

    This part was really useful; thanks a lot!

    A happy new year to you.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook