Algorithm for smooth exponential curves

896 Views Asked by At

I want to plot an exponential curve between 256 and 0. Using the following equasion, I get the resulting data set. (Please note that I am rounding any decimals down to nearest whole number throughout this question)

Equasion

x = x / 2;

Data

256, 128, 64, 32, 16, 8, 4, 2, 1, 0

Curve

enter image description here

The algorithm above took 10 iterations before it reached 0 (since there are 10 values in the data set).

Say for example, I know how many iterations should occur, is there a way to work out the number that x should be divided by, given the number of iterations?

Example

I want to generate a smoother curve, still based on the values 256 and 0, but it should appear smoother because there are more points in the data set.

Equasion

x = x / 1.2

Data

256, 213, 177, 147, 122, 101, 84, 70, 58, 48, 40, 33, 27, 22, 18, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 0

Curve

enter image description here

In this example, the curve is much smoother because there are more data points to plot it.

Say for example, the only thing I knew about this example was

  • The maximum and minimum numbers
  • There must be 26 iterations

How do I work out what x must be divided by to get the target iteration count?

x = x / ???
1

There are 1 best solutions below

0
On

It is approximately $256^{1/n}$ where $n$ is the number of iterations, and suppose $256$ is your upper bound.