I have an upper and lower bound number: upper: 21; lower: 3; I then have a second number that can be anywhere between this range, I would like the second number to increment faster when it is closer to the lower bound and slower when it is closer to the upper bound. How can I achieve this using mathematics?

mashingcho9v

mashingcho9v

Answered question

2022-09-07

I have an upper and lower bound number:
upper: 21
lower: 3
I then have a second number that can be anywhere between this range, I would like the second number to increment faster when it is closer to the lower bound and slower when it is closer to the upper bound.
How can I achieve this using mathematics?

Answer & Explanation

coccusk7

coccusk7

Beginner2022-09-08Added 14 answers

Step 1
Suppose that the second number moves along the real number line between 3 and 21. We want its speed to be higher when it is close to 3, and lower when it is close to 21, but always moving upwards. I assume you don't want it to pass 21 (or ever quite reach it for that matter).
So, let x(t) be the position of the second number at time t. Where it starts is x(0), and we will call this number K and let it lie anywhere on the half-open interval [ 3 , 21 ). As x(t) increases, we want the velocity of the second number to decrease. One way to model this would be:
Velocity ( t ) = 21 x ( t ).
Notice, the point will always move upwards towards 21, and would stop if it ever reached it.
Now, the velocity of the point is the rate of change of its position with respect to time. What we have is thus a differential equation:
d x d t = 21 x ( t )
If you have any experience with these equations, you will find that the solution to this equation is found by separating variables and is given by:
x ( t ) = 21 ( 21 K ) × e t , where K is the place the second point started off.
Whether you consider time to move in discrete jumps, ie. t = 0 , 1 , 2 , 3 , 4 , or you consider time to evolve continuosly as a real number, the last equation should do what you ask for.
In light of your edit and comments, notice that for y > 1, and x < 20, you are guaranteed that K ( 21 x ) y will give a greater rate of change in your radius with respect to a change in x than will K ( 21 x ). For small x s , the rate of change will be even greater still, as you required. The mathematical reason for this is that the second derivative of K ( 21 x ) y   w r t   x is positive. Have a think! Drawing a graph will make it much more obvious
Bordenauaa

Bordenauaa

Beginner2022-09-09Added 18 answers

Step 1
The notion of how quickly a function changes, in the language of sufficiently smooth functions, is called its derivative. If f is the function, we will write f′ for its derivative.
Note that from here on out, I will be using the function as follows. If x is the input number, then f(x) is the second number.
Using this terminology, you want a function with large derivative at small numbers, and small derivative at large numbers. In other words, you want the function's derivative to be decreasing.
We have a large supply of decreasing functions: we could consider a line, for instance, or perhaps a segment of 1 x . Or we could use some combination of these.The only other restriction is that f must be increasing, that is f ( x ) x . Since f ( x ) 21 , this means that f ( 21 ) = 21 . In the general vicinity of 21, we probably want the function to not affect numbers too much, for smoothness reasons. The easiest way to achieve this is to make f ( 21 ) = 0 .
Thus, we have reduced the problem to the following differential equation. Suppose that D ~ is our favorite decreasing function. Manipulate D ~ to become D such that D ( 21 ) = 0 ; this can be achieved always by shifting up/down D ( x ) = D ~ ( x ) + a for some constant a, or in some cases more desirable behavior is obtained by expanding/compressing D ( x ) = b D ~ ( x ) for some constant b. (Note that a and b are not arbitrary; they must be chosen correctly to get the desired outcome) From there, the constraints are to find an f such that
f ( x ) = D ( x )                         f ( 21 ) = 21
After choosing the desired D ~ and the appropriate manipulation, the problem can be solved using your favorite numerical or symbolic integrator, for example, Wolfram Alpha.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?