Iterations with the fixed result: I want to make some curves from 0 to 1.

GFabyz

New member
Joined
Apr 6, 2023
Messages
4
I want to make some curves from 0 to 1.
I need to calculate the growth variables of y from 0 to 1. So I tried this

int interations=1000;
float y, y_add=1./interations; // linear

for (int i; i<interations; i++) {
y += y_add; // linear
}
y result is 1 - works

float y_mlt = exp(-1/(interations)); // non linear slow grow on the first stage but fast grow in second
float a=0.582; // why it's 0.582 ?
y_add=a/interations;

for (int i; i<interations; i++) {
y = y*y_mlt + y_add; // non linear slow grow
}
y result is 1 - works

float y_mlt = exp(-1/(interations)); // non linear fast grow on the first stage but slow grow in second
y_add=(1+a)/interations;

for (int i; i<interations; i++) {
y = y*y_mlt + y_add; // non linear fast grow
}
y result is 1 - works

calc.png

The calculation of a was made by more trying, in a primitive way.

What I want:
1. Where does the value of a come from?
2. How do I extend the calculation to get more curves with faster or slower growth?
3. Maybe find a variable of acceleration
 
Last edited:
In the meantime I discovered some more things:

I managed to expand the formula and increase the acceleration as follows:

y_mlt = 1/exp(-q/interations); // slow grow on the first stage but fast grow in second
y_add=a/interations;

y_mlt = exp(-q/interations); // fast grow on the first stage but slow grow in second
y_add=(q+a)/interations;

I find a constants for q as integer number

q=1 - - - - - - a=0.582
q=2 - - - - - - a=0.313
q=3 - - - - - - a=0.1559
q=4 - - - - - - a=0.0743
q=5 - - - - - - a=0.0335

I don't know how to directly calculate these constants and extend the formula to decimal values for q

I suppose a series mean something, but what ?
 
I want to make some curves from 0 to 1.
I need to calculate the growth variables of y from 0 to 1. So I tried this
This is very cryptic, and, I suspect, not many people will try figuring out your problem by reading your code. I suggest that instead you try defining your problem more clearly. This way you will increase your chances of getting meaningful help.
 
Have no idea how to explain. From my opinion is clear with example.
 
Have no idea how to explain. From my opinion is clear with example.
It is far from clear to me. Here are some questions I have:

What does "...make some curves from 0 to 1" mean? Do you want to define a function analytically? Or tabulate it for a set of values between 0 and 1?

As for your examples, I don't see any curves there, only a computation of a scalar value [imath]y[/imath]. Do you mean that you are computing a sequence of [imath]y[/imath]'s and want to compute its "growth"? And do you need the average growth or growth at every point, i.e., every value of [imath]i[/imath] ?
 
Top