简体   繁体   中英

Exponential growth between two values in python

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM