creating a function of compound return accounting for monthly payments

16 Views Asked by At

I am trying to make a function that calculates a compound return on an investment, but monthly payments are made. I am making it in desmos, but have realized that simply subtracting the payment amount each month is inaccurate. The rate of increase remains the same as if the value was unchanged, when in actuality the rate would step down when payments are made due to having less capital with which to compound. This can be seen in the attached screenshot.

enter image description here

One can see that the red function is normal compounding growth whereas the green is the same function minus a payment every $30$ days. But, the green slope remains consistent with the red slope, when logically it should decrease a bit due to the payment. This leads to the case where a payment is made that drops below the zero line in the first few months and it somehow returns above the zero line because the slope is increasing as if no payments were made. If someone can guide me to an accurate function, that would be greatly appreciated!