What is the equation for a continuously compounded with monthly additions of $300$ dollars for the first $10$ years and $500$ for the next $20$ with an initial investment of $0$?
I know the equation $Pe^{rt}$ is used but i don't understand how to set it so $300$ dollars is added every month.
Calling the monthly savings $C,$ i.e. ($C=\$300$) and the monthly interest $m=r/12$ (divided by $12$ because time will be given in months, and presumably the interest rate $r$ is annual); and with the number of payments (for the first part of the problem $n=10[\text{years}]\times 12 [\text{months}]=120,$ it would seem like we could adapt the formula for an annuity, which is simply the application of the geometric series formula to payments $C$ that get different, and decreasing interest accumulation, depending on how early or late in the process they have been made (although at regular intervals) as in
$$\begin{align} \text{Future Value}&=C(1+m)^{n-1} + C(1+m)^{n-2} + \cdots+ C(1+m)+ C\\ &=C\sum_{k=0}^{n-1} (1+m)^k\\ &=C\frac{1-(1+m)^n}{1-(1+m)}\\ &=C\frac{(1+m)^n-1}{(1+m)-1}\\ &=C\frac{(1+m)^n-1}{m} \end{align}$$
With this formula, there is one payment that gets no interest, at the end, which is the last $C$ in the series. And the first payment has to wait a month to receive the first interest, accounting for the $n-1$ in the first term. With continuous interest, and the formulation of the OP, however, the first payment at time $0$ would receive interest throughout the entire time, and presumably the last payment would be at month $n-1,$ accruing interest for one month.
The monthly interest $(1+m)$ here turns into $e^{m}, $ so that for a $6\%=0.06$ annual interest, the continuously compounding interest would be (again, assuming that time is in months) $e^{0.06/12}=1.004175.$ Hence,
$$\begin{align} FV&=C\frac{1-(1+m)^n}{1-(1+m)}\\ &=C\frac{e^{mn}-1}{e^m - 1} = \$49,203.91 \end{align}$$
The considerations about the first or last payment, can be easily compensated for with the formula for continued interest $FV=Ce^{mt},$ where here $t=1$ would be $1$ month.
As for the second part of the OP, $C=\$500$ for $n=20\times 12=240,$ an equivalent calculation will yield $\$231,432.15.$
If the contributions of the first part of the question are still compounding during these $20$ additional years, we'll have to add their value after these last $20$ years, calculated as $\$49,203.91 e^{0.005\times 240}=\$163,362.73.$ So the total at a fixed annual $6\%$ would be $\$394,794.89.$