Calculadora VPL & TIR
Calcula o Valor Presente Líquido (VPL) e a Taxa Interna de Retorno (TIR).
Year 1
Year 2
Year 3
Perguntas Frequentes
Implementação de Código
def calculate_npv(discount_rate, initial_investment, cash_flows):
"""
discount_rate: annual rate as decimal (e.g., 0.10 for 10%)
initial_investment: upfront cost (positive number)
cash_flows: list of annual cash flows starting at year 1
"""
pv_sum = sum(cf / (1 + discount_rate) ** (t + 1)
for t, cf in enumerate(cash_flows))
npv = pv_sum - initial_investment
return npv
# Example: $50,000 investment, 10% discount rate, 5-year project
initial_investment = 50000
discount_rate = 0.10
cash_flows = [15000, 18000, 20000, 22000, 25000]
npv = calculate_npv(discount_rate, initial_investment, cash_flows)
print(f"NPV: ${npv:,.2f}")
print("Decision:", "Accept (NPV > 0)" if npv > 0 else "Reject (NPV < 0)")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.