R/continuous_compounding.R

#' @title Continuous comounding
#'
#' @description
#' source: https://en.wikipedia.org/wiki/Compound_interest
#'
#'  @param p0 is the initial amount.
#'  @param t is the overall length of time the interest is applied (expressed using the same time units as r, usually years).
#' @param r is the nominal annual interest rate is the nominal annual interest rate (as percent e.g. 4.5).
#'
#' @return The amount after t periods of continuous compounding.
#'
#' @examples
#' continuous_compounding(1000, 5, 0.045)
#'
#' @export
continuous_compounding <- function(p0, t, r) {
  r <- r / 100
  p0 * exp(r * t)
}
pgstevenson/borrowr documentation built on May 15, 2019, 10:02 p.m.