Exponential growth between two values in python

Viewed 736

As title, I need an array between two fixed values which follows and exponential growth. Just to explain better, I have initial weight and final weight values, and I want the values in the array going from the final weight value (1.08) to the initial weight (1.48) following an exponential growth. Can someone help me?

1 Answers

Something like that?

np.logspace(np.log(1.08), np.log(1.48), 10, base=np.exp(1))

This prints:

array([1.08      , 1.11847936, 1.1583297 , 1.19959987, 1.24234045,
   1.28660384, 1.3324443 , 1.379918  , 1.42908315, 1.48      ])

The 10 is the number of steps, you can increase or decrease it.

Related