 <pre><code>pv = function(fv, d, t) fv/(1+d)^t pv(1.05^2, 0.05, c(1, 2)) </code></pre> <p>Here's an explanation. Basically, in R, algebraic functions are applied automatically over numeric data, such that looping is often unnecessary.</p>