Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Data Science for Finance

Problem Set 3

Exercise 1:

a)

Define a function that takes in a list of project cash flow, initial investment, discount rate and then solves for the profitability index of a specific project.

Where CFi is the cash inflow in year i, r is the annualized discount rate, I is the initial investment.

b)

Define a function that takes in a list of project cash flow, initial investment, and then solves for the payback period of a specific project.

Payback period refers to the number of years until the initial investment is recovered.

Exercise 2:

In this exercise, you will need to define a function to generate the loan amortization table. The amortization table gives the repayment amount for the loan each period, and breaks down the total repayment into the interest paid and principal paid. In this exercise we assume the loan is repaid monthly. The function will take in several parameters, including the total loan amount, number of monthsto repay the loan, the annualized interest rate (APR). The loan is designed to have the same repayment amount each month.

Exercise 3:

Rewrite the function for generating the loan amortization table. Now instead of assuming that the loan has the same repayment amount each month, we assume that the loan is designed to repay the same amount of principal each month. In this case, the repayment amount will vary each month since the interest paid will be different each month.