Generating monotonic decreasing functions

AI Thread Summary
The discussion focuses on generating monotonic decreasing functions that pass through specific points, f(0) = a and f(1) = 1. Participants share various function forms, including polynomial and exponential functions, that meet these criteria. A method for constructing such functions involves starting with a base function, adjusting it to meet the constraints, and scaling appropriately. Examples provided demonstrate the flexibility in choosing different types of functions while adhering to the monotonic decreasing requirement. The exchange concludes with appreciation for the shared methods, indicating successful application in fluid dynamics code testing.
ephedyn
Messages
169
Reaction score
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:
Mathematics news on Phys.org
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?
 
Also...

a*cos[ (pi/2) x/(x+1) (4/pi)arccos(1/a)]
 
csprof2000 said:
[1/(e-1)](a-1)(exp(-x^n+1) - 1) + 1

Also...

a*cos[ (pi/2) x/(x+1) (4/pi)arccos(1/a)]

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 ><;)?
 
Maybe...

[(1-a)/ln(1/2)]ln(1/(x+1)) + a
 
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

exp(-x)

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.
 
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!

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.

A happy new year to you.
 

Similar threads

Replies
5
Views
2K
Replies
2
Views
1K
Replies
4
Views
3K
Replies
6
Views
2K
Replies
1
Views
1K
Back
Top