For example if I have an array with integers in an accending order - var intArray = [2, 6, 7, 10, 30, 50, 70, 90, 140, 200, 202, 207, 213, 215]

How to write a function, that will identify the beginning of exponential growth, that starts with the integer 10, and ends with the integer 200? In other words, how to write a function that recognizes the start of the growth and the start of the decay within the array?

Okay, I'm getting answers about not stating a correct exponential growth. That is not the case. The main thing I want to find out - How to find the moment when integer values extremely increase and decrease?

有帮助吗?

解决方案

If a function grows exponentially, the log of the function grows linearly.

Here is your data:

[2, 6, 7, 10, 30, 50, 70, 90, 140, 200, 202, 207, 213, 215]

Here is the log of your data:

[0.693147, 1.79176,  1.94591,  2.30259,  3.4012,  3.91202,  4.2485,
 4.49981,  4.94164,  5.29832,  5.30827,  5.33272, 5.36129,  5.37064]

You can see a plot of the log data here: Wolfram Alpha link

Notice that between the 5th and 10th items the plot increases linearly. In this region, the values are growing exponentially. If you want to be more lenient, you might say it increases roughly exponentially between the 1st and 10th items.

You haven't been very precise in exactly how you want to characterize "the start of exponential growth" so I won't say more unless you clarify.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top