Answer the question
In order to leave comments, you need to log in
How to implement a gradual increase in the number?
I don't know how to better phrase the question in the title.
I'm not very good at math, so I have to ask for help.
I'll try to describe it in more detail here. There is such a thing as a geometric progression and everyone knows about it, but it's too simple for my task.
There are two numbers: X and Y
X = 1000
Y = 0.1
I want that every time X increases by 100, Y increases, but its increase will be the greater, the more X. For example:
X = 1000, Y = 0.1
X = 1100, Y = 0.12, +0.02
X = 1200, Y = 0.144, +0.024
X = 1300, Y = 0.175, +0.031
And so on. Each time the increase is stronger.
Honestly, I want to pick up the values by eye so that with X = 5000, Y would be equal to ~ 12-15.
It would be nice to have some coefficient in the formula to control the rate of increase in the number.
How to do it right?
Answer the question
In order to leave comments, you need to log in
$x = 1; $y = $x/20;
$x = $x+$y;
You need a quadratic (or other power) dependence: y = x^2
.
The derivative of this expression will be the growth rate of the function:y′ = 2x
Method of finite differences.
0.100; 0.120; 0.144; 0.175 etc. - from below, attribute the difference between the members.
0.020; 0.022; 0.031; etc. - and again from below, attribute the difference.
0.002; 0.009; etc. - and so on
until the same numbers appear in the line.
In this case, the number of rows is the power of the formula a(n) * xⁿ + ... a₃ * x³ + a₂ * x² + a₁ * x + a₀
This formula, as I understand it, you are looking for. But this method is only for p̲o̲l̲i̲n̲o̲m̲i̲a̲l̲b̲n̲o̲g̲o̲ expression, not for exponential, trigonometric or any other.
There, the method describes how to extract the coefficients a₁, a₂... from the calculated triangle, but I don’t remember how.
deltaY = exp((x-900)/1480) - exp((x-1000)/1480)
1000 +0,069902548 0,079902548
1100 +0,074788914 0,154691462
1200 +0,08001685 0,234708312
1300 +0,085610231 0,320318543
...
4800 +0,911115494 12,95519682
4900 +0,974804788 13,93000161
5000 +1,042946127 14,97294774
An example of a task implementation in PHP:
$x = $result = [];
$minY = 0.1;
$minX = 1000;
$maxX = 5000;
$dX = 100;
for( $n = $minX; $n <= $maxX; $n += $dX)
$x[] = $n;
foreach ($x as $val)
$result[$val] = ($minY * ($val ** 3) )/($minX ** 3);
echo '<pre>';
print_r($x);
print_r($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question