Hey fellas, I'd love some help with this.

Say I've got an expression like so:

c = p^1.4/1000

Where p is the current price.

And c is the amount that price will be adjusted by. The change.

I'm writing a program where, if someone orders 1 item, the expression will be run and p will become p + c.

If someone orders 500 items, the expression will be run 500 times, getting the new price, then plugging that new price into the expression again that many times before getting the new price of the item after 500 purchases.

However, as you can imagine, especially for large orders, the process time for this can be extremely long.

I'm desperately looking for a math-y way to emulate all those purchases within just one passover of the expression.

Obviously, the price doesn't change by the same amount every time the expression is run, since it's dependent on its own price, so a simple "p = p + c * amount" won't work.

Thanks for everyone who's given this some thought. I really appreciate it.

## Bookmarks