Is my solution correct? [Compound Monthly Problem] "Find a formula for the present value of $n$ dollars $k$ years from now, assuming an interest rate of $r$% compounded monthly. You can check your answer by using , $n = 10000$, $k = 1$ , and $r = 8$, comparing the result to part (a). "

The result in part (a) was: $(1+0.0066666667)^12*x=10000. $ giving $x = 9233.61$



Answer:

The present value formula is $\frac{n}{(1+(\frac{r}{100}))^k}$ for $n$ dollars $k$ years from now, assuming an interest rate of $r$% compounded anually. However we must divide $r$ by $12$ since the interest is compounded monthly. Also we must multiply $k$ by $12$ since the interest is compounded monthly. Thus our present value formula of $n$ dollars $k$ years from now, assuming an interest rate of r% compounded monthly is $\frac{n}{(1+((\frac{r}{1200}))^{12k}}$



Does anyone have advice on how to clean up my answer or if it is wrong, why?
Did cost increase or decrease?

if cost increase:

&gt;&gt;&gt; def f(n, k, r):
...     return n*(1.0 + r/1200.0)**(12.0 * k)
... 
&gt;&gt;&gt; f(10000, 1, 8)
10829.995068075097


if cost decrease:

&gt;&gt;&gt; def f(n, k, r):
...     return n/((1.0 + r/1200.0)**(12.0 * k))
... 
&gt;&gt;&gt; f(10000, 1, 8)
9233.614546582965
Did cost increase or decrease?

if cost increase:

&gt;&gt;&gt; def f(n, k, r):
...     return n*(1.0 + r/1200.0)**(12.0 * k)
... 
&gt;&gt;&gt; f(10000, 1, 8)
10829.995068075097


if cost decrease:

&gt;&gt;&gt; def f(n, k, r):
...     return n/((1.0 + r/1200.0)**(12.0 * k))
... 
&gt;&gt;&gt; f(10000, 1, 8)
9233.614546582965