added python code
This commit is contained in:
parent
27a415fef2
commit
d3bcdeefdd
1 changed files with 172 additions and 0 deletions
172
mba/ch66.org
172
mba/ch66.org
|
|
@ -7,3 +7,175 @@
|
||||||
- [[https://www.udemy.com/course/an-entire-mba-in-1-courseaward-winning-business-school-prof/learn/lecture/4301156#overview][S12:L66 course video]]
|
- [[https://www.udemy.com/course/an-entire-mba-in-1-courseaward-winning-business-school-prof/learn/lecture/4301156#overview][S12:L66 course video]]
|
||||||
|
|
||||||
* notes
|
* notes
|
||||||
|
- easier way to do [[*Discounted Cash Flow (DCF)][DCF]]
|
||||||
|
- [[*Net Present Value (NPV)][NPV]]
|
||||||
|
|
||||||
|
* definitions
|
||||||
|
** Discounted Cash Flow (DCF)
|
||||||
|
In finance, DCF is a method used to estimate the value of an investment, company, or project
|
||||||
|
based on its expected future cash flows, adjusted for the time value of money.
|
||||||
|
|
||||||
|
*** Basic Steps
|
||||||
|
1. Forecast future cash flows (e.g., for the next –10 years)
|
||||||
|
2. Choose a discount rate (often Weighted Average Cost of Capital, WACC)
|
||||||
|
3. Discount each year’s cash flow to its present value
|
||||||
|
4. Sum the present values to get the total estimated value
|
||||||
|
|
||||||
|
*** Formula
|
||||||
|
#+BEGIN_SRC text
|
||||||
|
PV = Cash Flow in Year n / (1 + r)^n
|
||||||
|
#+END_SRC
|
||||||
|
Where:
|
||||||
|
- r = discount rate
|
||||||
|
- n = year number
|
||||||
|
- PV = present value
|
||||||
|
|
||||||
|
*** Key Insight
|
||||||
|
The result represents the estimated worth of the investment *today*
|
||||||
|
based on its future cash-generating potential.
|
||||||
|
|
||||||
|
** Net Present Value (NPV)
|
||||||
|
NPV is a financial metric used to determine the profitability of an investment or project by comparing the present value of cash inflows with the present value of cash outflows
|
||||||
|
|
||||||
|
- https://www.investopedia.com/ask/answers/021115/what-formula-calculating-net-present-value-npv-excel.asp
|
||||||
|
|
||||||
|
*** Purpose
|
||||||
|
- Shows whether an investment will add value to a business
|
||||||
|
- Helps compare different investment opportunities
|
||||||
|
|
||||||
|
*** Formula
|
||||||
|
#+BEGIN_SRC text
|
||||||
|
NPV = Σ [ Cash Flow_t / (1 + r)^t ] − Initial Investment
|
||||||
|
#+END_SRC
|
||||||
|
Where:
|
||||||
|
- t = year iteration. ie, 1, 2, 3... not the actual year
|
||||||
|
- r = discount rate [[*Weighted Average Cost of Capital (WACC)][WACC]]
|
||||||
|
- Cash Flow_t = cash flow at time t
|
||||||
|
|
||||||
|
*** Python Formula
|
||||||
|
#+BEGIN_SRC python
|
||||||
|
def present_value(t, cash_flow, wacc):
|
||||||
|
"""
|
||||||
|
Calculate the present value of a future cash flow.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
t : int -> Year index (0 for present year, 1 for next year, etc.)
|
||||||
|
cash_flow : float -> Cash flow amount for year t
|
||||||
|
wacc : float -> Weighted Average Cost of Capital (as decimal, e.g., 0.08 for 8%)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
float -> Present value of the given cash flow
|
||||||
|
"""
|
||||||
|
# Discount factor = (1 + WACC)^t
|
||||||
|
# The factor by which a future value is reduced to account for time & cost of capital
|
||||||
|
discount_factor = (1 + wacc) ** t
|
||||||
|
|
||||||
|
# Present Value = Future Cash Flow / Discount Factor
|
||||||
|
return cash_flow / discount_factor
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC python
|
||||||
|
def npv_formula(cash_flow_list, wacc):
|
||||||
|
"""
|
||||||
|
Calculate Net Present Value (NPV) for a series of cash flows.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
cash_flow_list (list[float]): List of cash flows for each period,
|
||||||
|
where index 0 is the first period's cash flow.
|
||||||
|
wacc (float): Weighted Average Cost of Capital (discount rate)
|
||||||
|
expressed as a decimal (e.g., 0.08 for 8%).
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
float: Net Present Value (NPV) of the given cash flows.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Uses the present_value() function for discounting each cash flow.
|
||||||
|
Assumes cash flows occur at the end of each period.
|
||||||
|
"""
|
||||||
|
net_value = 0
|
||||||
|
for index, cash_flow in enumerate(cash_flow_list):
|
||||||
|
net_value += present_value(t=index, cash_flow=cash_flow, wacc)
|
||||||
|
|
||||||
|
return net_value
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC python
|
||||||
|
def npv_value(cash_flow_list, initial_outlay, wacc):
|
||||||
|
"""
|
||||||
|
Calculate Net Present Value (NPV) by subtracting the initial investment
|
||||||
|
from the present value of future cash flows.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
cash_flow_list (list[float]): List of future cash flows for each period,
|
||||||
|
where index 0 is the first period's cash flow.
|
||||||
|
initial_outlay (float): The initial investment or project cost.
|
||||||
|
wacc (float): Weighted Average Cost of Capital (discount rate)
|
||||||
|
expressed as a decimal (e.g., 0.08 for 8%).
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
float: Net Present Value (NPV).
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
This function calls net_pv() to calculate the sum of discounted
|
||||||
|
cash flows, then subtracts the initial_outlay.
|
||||||
|
"""
|
||||||
|
return net_pv(cash_flow_list, wacc) - initial_outlay
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Steps
|
||||||
|
1. Identify each expected cash inflow for future periods.
|
||||||
|
2. Discount each inflow using the discount rate \( r \) and period \( t \).
|
||||||
|
3. Add the discounted values together.
|
||||||
|
4. Subtract the initial investment cost.
|
||||||
|
|
||||||
|
*** Interpretation
|
||||||
|
- NPV > 0 → Investment is profitable
|
||||||
|
- NPV = 0 → Break-even
|
||||||
|
- NPV < 0 → Investment will lose money
|
||||||
|
|
||||||
|
*** Key Difference from DCF
|
||||||
|
- DCF is the method of valuing future cash flows
|
||||||
|
- NPV is the *result* after subtracting the initial cost from the DCF
|
||||||
|
|
||||||
|
** Weighted Average Cost of Capital (WACC)
|
||||||
|
*** Formula
|
||||||
|
#+BEGIN_SRC latex
|
||||||
|
WACC = \frac{E}{V} \times Re + \frac{D}{V} \times Rd \times (1 - Tc)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Variables
|
||||||
|
- \( Re \) = [[*Cost of Equity (Re)][Cost of Equity]]
|
||||||
|
- \( Rd \) = [[*Cost of Debt (Rd)][Cost of Debt]]
|
||||||
|
- \( E \) = Market value of the firm's equity
|
||||||
|
- \( D \) = Market value of the firm's debt
|
||||||
|
- \( V \) = \( E + D \) (Total market value of financing)
|
||||||
|
- \( \frac{E}{V} \) = Percentage of financing that is equity
|
||||||
|
- \( \frac{D}{V} \) = Percentage of financing that is debt
|
||||||
|
- \( Tc \) = Corporate tax rate
|
||||||
|
|
||||||
|
*** Notes
|
||||||
|
- WACC represents the average rate that a company is expected to pay to finance its assets.
|
||||||
|
- It is used as the discount rate in DCF calculations.
|
||||||
|
|
||||||
|
** Cost of Equity (Re)
|
||||||
|
- The return required by equity investors for investing in a company.
|
||||||
|
- Often estimated using the Capital Asset Pricing Model (CAPM):
|
||||||
|
#+BEGIN_SRC
|
||||||
|
Re = Rf + β * (Rm - Rf)
|
||||||
|
Rf = Risk-free rate
|
||||||
|
β = Beta (measure of stock's volatility vs. market)
|
||||||
|
Rm = Expected market return
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Cost of Debt (Rd)
|
||||||
|
- The effective interest rate a company pays on its borrowed funds, adjusted for tax savings.
|
||||||
|
- Formula:
|
||||||
|
#+BEGIN_SRC
|
||||||
|
Rd = Effective Interest Rate * (1 - Tc)
|
||||||
|
#+END_SRC
|
||||||
|
- Example:
|
||||||
|
#+BEGIN_SRC
|
||||||
|
If Effective Interest Rate = 6%
|
||||||
|
Tc = 25%
|
||||||
|
Rd = 0.06 * (1 - 0.25) = 0.045 (4.5%)
|
||||||
|
#+END_SRC
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue