This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to simulate the scenario with investment coming from the original principal and annual interest on the investment | |
def simulate_investment(principal, withdraw_amount, invest_amount, no_of_years, annual_interest_rate=0.12, annual_withdrawal_increase=0.10): | |
# Initialize variables | |
total_investment = 0 # Amount in investments (compounded annually) | |
current_principal = principal # Starting amount | |
current_withdraw_amount = withdraw_amount # Monthly withdrawal amount | |
months_in_year = 12 # Number of months in a year | |
months = no_of_years * 12 # Total number of months | |
# Iterate through each month |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Withdrawal Calculator | |
def calculate_remaining_balance(principal, annual_rate, withdraw, annual_increase, no_of_years): | |
# Annual compounding interest rate | |
rate = annual_rate / 100 | |
for year in range(1, no_of_years + 1): | |
# Compound the interest annually | |
principal *= (1 + rate) | |
# Withdraw monthly for the year |