lib/finance/time_value.rb
##
# determine the investment horizon (length of time) required
# to create a future value given a present value and interest rate
# *present_value - the value at the start of the period
# *future_value - the value at the end of the period
# *rate - the annual rate of return
#
determine the investment horizon (length of time) required
to create a future value given a present value and interest rate
present_value - the value at the start of the period
future_value - the value at the end of the period
rate - the annual rate of return
determine the investment horizon ( length of time ) required to create a future value given a present value and interest rate present_value - the value at the start of the period future_value - the value at the end of the period rate - the annual rate of return
def investment_horizon(rate,present_value,future_value)
      pv = present_value.to_d
      fv = future_value.to_d
      periods = Math.log(fv/pv) / Math.log(1+rate)
    end
def investment_horizon ( rate , present_value , future_value ) pv = present_value . to_d fv = future_value . to_d periods = Math . log ( fv / pv ) / Math . log ( 1 + rate ) end
determine the investment horizon (length of time) required
to create a future value given a present value and interest rate
present_value - the value at the start of the period
future_value - the value at the end of the period
rate - the annual rate of return
determine the investment horizon ( length of time ) required to create a future value given a present value and interest rate present_value - the value at the start of the period future_value - the value at the end of the period rate - the annual rate of return
rate
present_value
future_value