Basic Financial Mathematics



Similar documents
FI3300 Corporate Finance

YIELD TO MATURITY ACCRUED INTEREST QUOTED PRICE INVOICE PRICE

AMB111F Financial Maths Notes

CONCEPT OF TIME AND VALUE OFMONEY. Simple and Compound interest

Valuation of Floating Rate Bonds 1

How Much Should a Firm Borrow. Effect of tax shields. Capital Structure Theory. Capital Structure & Corporate Taxes

INITIAL MARGIN CALCULATION ON DERIVATIVE MARKETS OPTION VALUATION FORMULAS

Chapter 3 Savings, Present Value and Ricardian Equivalence

Continuous Compounding and Annualization

Ilona V. Tregub, ScD., Professor

GESTÃO FINANCEIRA II PROBLEM SET 1 - SOLUTIONS

Learning Objectives. Chapter 2 Pricing of Bonds. Future Value (FV)

est using the formula I = Prt, where I is the interest earned, P is the principal, r is the interest rate, and t is the time in years.

Solutions to Problems: Chapter 7

Exam #1 Review Answers

STUDENT RESPONSE TO ANNUITY FORMULA DERIVATION

The LCOE is defined as the energy price ($ per unit of energy output) for which the Net Present Value of the investment is zero.

Things to Remember. r Complete all of the sections on the Retirement Benefit Options form that apply to your request.

Definitions and terminology

Firstmark Credit Union Commercial Loan Department

4a 4ab b (count number of places from first non-zero digit to

Personal Saving Rate (S Households /Y) SAVING AND INVESTMENT. Federal Surplus or Deficit (-) Total Private Saving Rate (S Private /Y) 12/18/2009

9:6.4 Sample Questions/Requests for Managing Underwriter Candidates

CHAPTER 10 Aggregate Demand I

Loyalty Rewards and Gift Card Programs: Basic Actuarial Estimation Techniques

Problem Set # 9 Solutions

Ignorance is not bliss when it comes to knowing credit score

SUGGESTED SOLUTIONS Strategic Financial Management. CA Professional (Strategic Level II) Examination June 2014

9.4 Annuities. Objectives. 1. Calculate the future value of an ordinary annuity. 2. Perform calculations regarding sinking funds.

Analysis of Deterministic Cash Flows and the Term Structure of Interest Rates

The Predictive Power of Dividend Yields for Stock Returns: Risk Pricing or Mispricing?

Understanding Financial Management: A Practical Guide Guideline Answers to the Concept Check Questions

Finance Practice Problems

Controlling the Money Supply: Bond Purchases in the Open Market

9.5 Amortization. Objectives

Problems and Solutions

Zero-Coupon Bonds (Pure Discount Bonds)

Chapter 11: Aggregate Demand II, Applying the IS-LM Model Th LM t

Coordinate Systems L. M. Kalnins, March 2009

Gauss Law. Physics 231 Lecture 2-1

How To Find The Optimal Stategy For Buying Life Insuance

Converting knowledge Into Practice

Prepared by: Dalia A. Marafi Version 2.0

Chapter 11. Bond Pricing - 1. Bond Valuation: Part I. Several Assumptions: To simplify the analysis, we make the following assumptions.

Derivation of Annuity and Perpetuity Formulae. A. Present Value of an Annuity (Deferred Payment or Ordinary Annuity)

Spirotechnics! September 7, Amanda Zeringue, Michael Spannuth and Amanda Zeringue Dierential Geometry Project

Questions & Answers Chapter 10 Software Reliability Prediction, Allocation and Demonstration Testing

Financing Terms in the EOQ Model

A Note on Risky Bond Valuation

Trading Volume and Serial Correlation in Stock Returns in Pakistan. Abstract

AN IMPLEMENTATION OF BINARY AND FLOATING POINT CHROMOSOME REPRESENTATION IN GENETIC ALGORITHM

Discounted Cash Flow Valuation

Chapter 5: Valuing Bonds

Risk Sensitive Portfolio Management With Cox-Ingersoll-Ross Interest Rates: the HJB Equation

I = Prt. = P(1+i) n. A = Pe rt

Bond Price Arithmetic

Discussion Papers in Economics

The transport performance evaluation system building of logistics enterprises

The impact of migration on the provision. of UK public services (SRG ) Final Report. December 2011

Define What Type of Trader Are you?

Chapter 6. Discounted Cash Flow Valuation. Key Concepts and Skills. Multiple Cash Flows Future Value Example 6.1. Answer 6.1

1. Time Value of Money 3 2. Discounted Cash Flow Statistics and Market Returns Probabilities Key Formulas 109

Chapter 8. Step 2: Find prices of the bonds today: n i PV FV PMT Result Coupon = 4% ? Zero coupon ?

Deflection of Electrons by Electric and Magnetic Fields

CHAPTER 14: BOND PRICES AND YIELDS

2. Determine the appropriate discount rate based on the risk of the security

CALCULATOR TUTORIAL. Because most students that use Understanding Healthcare Financial Management will be conducting time

Interest Rates and Bond Valuation

The Binomial Distribution

Open Economies. Chapter 32. A Macroeconomic Theory of the Open Economy. Basic Assumptions of a Macroeconomic Model of an Open Economy

VISCOSITY OF BIO-DIESEL FUELS

1.4 Interest-Rate calculations and returns

Finding the Payment $20,000 = C[1 1 / ] / C = $488.26

UNIT CIRCLE TRIGONOMETRY

Excel Financial Functions

Fixed Income Attribution: Introduction

Faithful Comptroller s Handbook

Optimal Capital Structure with Endogenous Bankruptcy:

Financial Derivatives for Computer Network Capacity Markets with Quality-of-Service Guarantees

Database Management Systems

Chapter 6 APPENDIX B. The Yield Curve and the Law of One Price. Valuing a Coupon Bond with Zero-Coupon Prices

Carter-Penrose diagrams and black holes

Application for Admission GENEVA COLLEGE

Software Engineering and Development

CHAPTER 14: BOND PRICES AND YIELDS

Instructions to help you complete your enrollment form for HPHC's Medicare Supplemental Plan

Saving and Investing for Early Retirement: A Theoretical Analysis

Promised Lead-Time Contracts Under Asymmetric Information

Chapter 4: Time Value of Money

Transcription:

Financial Engineeing and Computations Basic Financial Mathematics Dai, Tian-Shy

Outline Time Value of Money Annuities Amotization Yields Bonds

Time Value of Money PV + n = FV (1 + FV: futue value = PV ( + n PV: pesent value : inteest tate FV 1 n: peiod tems

Quotes on Inteest Rates is assumed to be constant in this lectue. Annualized ate.

Time Value of Money Peiodic compounding (If inteest is compounded m times pe annum nm FV = PV 1 + m Continuous compounding (3.1 FV = PVe n m 1 1 n lim(1 + = e lim(1 + = lim(1 + = e t t m m m m/ t nm n Simple compounding

Common Compounding Methods Annual compounding: m = 1. Semiannual compounding: m = 2. Quately compounding: m = 4. Monthly compounding: m = 12. Weekly compounding: m = 52. Daily compounding: m = 365

Two widely used yields Bond equivalent yield (BEY --Annualize yield with semiannual compounding Motgage equivalent yield (MEY --Annualize yield with monthly compounding

Equivalent Rate pe Annum Annual linteest ate is 10% compounded d twice pe annum. Each dolla will gow to be 1.1025 one yea fom now. ( 1 + (0.1/ 2 2 = 1. 1025 The ate is equivalent to an inteest ate of 10.25% compounded d once pe annum.

Convesion between compounding Methods Suppose 1 is the annual ate with continuous compounding. Suppose 2 is the equivalent compounded m times pe annum. 1 + 2 m Then 1 Theefoe 1 m = e + 1 = ln 1 2 = m m 2 m e 1 m

Ae They Really Equivalent? Recall 1 and 2 on the pevious example. They ae based on diffeent cash flow. In what sense ae they equivalent?

Annuities Odinay annuity Annuity due Pepetual annuity

Odinay annuity An annuity pays out the same C dollas at the end of each yea fo n yeas. With a ate of, the FV at the end of nth yea is n 1 n i (1 1 C (1 + = C + (3.4 i= 0 c c 1 2 3 n

Geneal annuity If m payments of C dollas each ae eceived pe yea (the geneal annuity, then Eq.(3.4 becomes ( 1 + n m m 1 C m The PV of a geneal annuity is ( 1+ nm i 1 m C 1 + = C i= 1 m m n m (3.6

Annuity due Fo the annuity due, cash flow ae eceived at the beginning i of each yea. The FV is n i= 1 C (1 + i (1 + = C n 1 (1 + (35 (3.5 If m payments of C dollas each ae eceived pe yea (the geneal annuity, then Eq.(3.5 becomes C c (1 + m m n m 1 (1 + m 0 1 2 3 n

Fomula Odinay annuity PV: 1 (1 + C n Geneal annuity 1 (1 + C m m n m FV: C n ( 1 + 1 C nm ( 1+ m m 1 Annuity due 1 (1 + n PV: C (1 + 1 (1 + C m m n m 1 + m (1 + n 1 FV: C (1 + nm (1 + m 1 C 1 + m m

Pepetual annuity An annuity that lasts foeve is called a pepetual annuity. We can dive its PV fom Eq.(3.6 by letting n go to infinity: i nm i ( 1 1 + nm m PV = lim C 1+ = lim C = n n i 1 m = This fomula is useful fo valuing pepetual fix- coupon debts. m mc

Example: The Golden Model Detemine the intinsic value of a stock. Let the dividend id d gows at a constant t ate Stock pice= Pesent value of the infinite seies of futue dividends. D D(1+g.. 0 1 2 3 D PV (All ft futue dividends id d = ; g g > Whee D: Expected dividend pe shae one yea fom now. : Requied ate of etun fo equity investo. g: Gowth ate in dividends id d (in pepetuity.

In Class Execise: Show that D PV (All futue dividends = ; > g g

Pesent value Computed by Excel PV(ate, npe, pmt, fv, type Rate: 各 期 的 利 率 Npe: 年 金 的 總 付 款 期 數 Pmt : 各 期 所 應 給 付 ( 或 所 能 取 得 的 固 定 金 額 Fv : 最 後 一 次 付 款 完 成 後, 所 能 獲 得 的 現 金 餘 額 Type 0=> 期 末 支 付 1=> 期 初 支 付

Computed by Excel Futue value FV (ate, npe, pmt, pv, type Rate: 各 期 的 利 率 Npe: 年 金 的 總 付 款 期 數 Pmt : 指 分 期 付 款 Pv : 指 現 值 或 一 系 列 未 來 付 款 的 目 前 總 額 Type 0=> 期 末 支 付 1=> 期 初 支 付

Example 3.2.1 The PV of an annuity of $100 pe annum fo 5 yeas at an annual inteest ate of 6.25%

In Class Execise In above example, please use Excel to compute the FV of an annuity of $100 pe annum fo 5 yeas at an annual inteest ate of 6.25%. Veify this esult equal to the futue value of the PV of $418.39.

Amotization It is a method of epaying a loan though hegula payment of inteest and pincipal. The size of the loan (the oiginal balance is educed by the pincipal pat of each payment. The inteest pat of each payment pays the inteest incued on the emaining i pincipal i lbalance. As the pincipal gets paid down ove the tem of the loan, the inteest pat of the payment diminishes. See next example!

Example: Home motgages Conside a 15-yea, $250,000 loan at 8.0% inteest ate, epay pythe inteest 12 pe month. Because PV = 250,000, n = 15, m= 12, and = 0.08 we can get a monthly payment C is $2,389.13. C C C $250000 = + +... + 0.08 0.08 2 0.08 12 15 (1 + (1 + (1 + 12 12 12 0.08 180 180 i 1 (1 0.08 + = 1 12 C + = C C i= 1 12 0.08 /12 = 2389.13

249277.536 (0.08/12 Payment-Inteest We compute it in last page

Calculating the Remaining i Pincipal i Right afte the kth payment, the emaining pincipal is the PV of the futue nm-k cash flows, C(1 + m 1 + C(1 + m 2 +... + C(1 + m ( nm k = 1 (1 + C m m nm+ k Time K nm-k Cash flow C C C

Yields The tem yield denotes the etun of investment. It has many vaiants. (1 Nominal yield (coupon ate of the bond (2 Cuent yield (3 Discount yield (4 CD-equivalent yield

Discount Yield U.S Teasuy bills is said to be issue on a discount basis and is called a discount secuity. When the discount yield is calculated fo shot-tem secuities, a yea is assumed to have 360 days. The discount yield (discount ate is defined as Inteest pa value puchase pice 360 days pa value numbe of days to matuity (3.9 Inteest ate Annualize

CD-equivalent yield It also called the money-maket-equivalent yield. It is a simple annualized inteest ate defined as pa value puchase pice 365 days puchase pice numbe of days to matuity (3.10

Example 3.4.1: 341 Discount yield If an investo buys a U.S.$10,000, 6-month T-bill fo US$9521 U.S.$9521.45 with 182 days emaining to matuity. 10000 9521.45 360 Discount yield= ild = 0. 0947 10000 182

Intenal Rate of Retun (IRR It is the inteest ate which hequates an investment s PV with its pice X. X = C 1 (1 + IRR 1 + C 2 (1 + IRR +... + C n (1 + IRR IRR assumes all cash flows ae einvested at the same ate as the intenal ate of etun. It doesn t conside the einvestment isk. 2 IRR is discount ate fo evey ypeiod n X C 1 C 2 C 3 Cn

Evaluating eal investment with IRR Multiple IRR aise when thee is moe than one sign evesal in the cash flow patten, and it is also possible to have no IRR. Evaluating eal investment, IRR ule beaks down when thee ae multiple IRR o no IRR. Additional poblems exist when the tem stuctue of inteest ates is not flat. thee is ambiguity about what the appopiate hudle ate (cost of capital should be.

Class Execise Assume that a poject has cash flow as follow espectively, and initial cost is $1000 at date 0,,please calculate the IRR. If cost of capital is 10%, do you think it is a good poject? CF at date 0 1 2 3 4 IRR -1000 800 1000 1300-2200?

Class Execise (Excel Multiple IRR

Holding Peiod Retun c Reinvest: e P 1 2 3 n The FV of investment in n peiod is FV = P ( 1+ y Let the einvestment ates e, the FV of pe cash income is n 1 n 2 C (1 + e + C (1 + e +... + C (1 + e + C Value is given We define HPR (y is n P(1 + y n = C (1 + e n 1 + C (1 + e n 2 +... + C (1 + e + C

Methodology fo the HPR(y Calculate the FV and then find the yield that equates it with the P Suppose the einvestment ates has been detemined to be e. Step Peiodic compounding Continuous compounding (1Calculate the futue value (2Find the HPR FV = n t= 1 C (1 + e n t FV = C n e ( e 1 e e 1 y 1 y = ln( = n P FV 1 n P FV

Example 3.4.5:HPR A financial instument pomises to pay $1,000 fo the next 3 yeas and sell fo $2,500. If each cash can be put into a bank account that pays an effective ate of 5%. 3 The FV is 1000 (1 + 0.05 t= 1 3 t = 3152.5 The HPR is 2500(1 + HPR 3 = 3125. 5 3152.5 HPR = 2500 1/3 1 = 0.0804

Numeical Methods fo Yield Solve f ( = n t= 1 Ct (1 + t x = 0, fo 1, x is maket pice Recall X = C C 1 1 Let f ( (1 + IRR (1 + IRR = C 1 1 1 (1 + +... + C +... + C 1 n n +... C (1 + IRR (1 + IRR n n (1 + n n X = X 0 The function f( is monotonic in, if C t > 0 fo all t, f(, t, hence a unique solution exists.

The Bisection Method Stat with a and b whee a < b and f(a f(b < 0. Then f( must tbe zeo fo some (a, b. If we evaluate f at the midpoint c (a + b / 2 (1 f(a f(c < 0 a<<c (2 f(c f(b < 0 c<<b Afte n steps we will have confined within a Afte n steps, we will have confined within a backet of length (b a / 2 n.

Bisection Method Lt Let f ( = C (1 + Solve f(=0 nc - x f( 1 + C (1 + 2 +... + C (1 + f(a>0,f(b<0 => a<<b Let c=(a+b/2 f(a>0 f(c<0 => a<<c n n X a IRR c b

C++: 使 用 while 建 構 二 分 法 float Low=0, High=1; 輸 入 每 期 報 酬 c, 期 數 n, 期 初 投 入 x 令 Middle =(High+Low/2; 找 出 R 落 在 (Low, Middle 或 (Middle,High while(high-low>=0.0001 false tue 程 式 碼 : float c,x,discount; float Low=0, High=1; int n; scanf("%f",&c; scanf("%f",&x; scanf("%d",&n; while(high-low>=0.0001 { } pintf("yield ate=%f",high;

用 Bisection method 縮 小 根 的 範 圍 已 知 f ( = c (1 + f(<0 >R f(>0 <R 1 + c (1 + 令 Middle=(High+Low/2 將 根 的 範 圍 從 (Low,High 縮 減 到 (Low,Middle (Middle,High c (1 + + c (1 + +... + c (1 + 用 計 算 債 券 的 公 式 計 算 2 1 2 n } 縮 小 根 的 範 圍 +... + c (1 + n float Middle=(Low+High/2; float Value=0; fo(int i=1;i<=n;i=i+1 { Discount=1; fo(int j=1;j<=i;j++ { x Discount=Discount/(1+Middle } Value=Value+Discount*c; } Value=Value-x; if(value>0 { Low=Middle;} else {High=Middle;}

計 算 計 算 IRR ( 完 整 程 式 碼 用 while 控 制 根 的 範 圍 1 2 c (1 + + c (1 + +... + c (1 + 計 算 (1+ i 縮 小 根 的 範 圍 n float c,x,discount; float Low=0 0, High=1; int n; scanf("%f",&c; scanf("%f",&x; scanf("%d",&n; while(high-low>=0.0001 { float Middle=(Low+High/2; float Value=0; fo(int i=1;i<=n;i=i+1 { Discount=1; fo(int j=1;j<=i;j++ { Discount=Discount/(1+Middle; Discount/(1+Middle; } Value=Value+Discount*c; } Vl Value=Value-x; Vl if(value>0 { Low=Middle;} else {High=Middle;} } pintf("yield ate=%f",high;

第 三 章 第 十 題 Homewok

The Newton-Raphson Method Conveges faste than the bisection method. Stat with a fist appoximation X 0 to a oot of f(x = 0. Then f( xk x k 1 x + k (3.15 f ( x k When computing yields, f ( x = t C n t t+ 1 t= 1 (1 + x Recall the bisection method, the X hee is (yield in the bisection method!

Figue3.5: Newton-Raphson method f(x k θ f( Xk f ( Xk = tanθ = X X X X = X k+ 1 X k+ 1 = k k k + 1 f( Xk f ( X k f( X f k ( X If f(x k+1 =0, we can obtain X k+1 is yield k k

Computed by Excel Yield 的 計 算 RATE( npe, pmt,,p pv, fv, type Npe: 年 金 的 總 付 款 期 數 Pmt : 各 期 所 應 給 付 ( 或 所 能 取 得 的 固 定 金 額 Pv : 期 初 付 款 金 額 Fv : 最 後 一 次 付 款 完 成 後, 所 獲 得 的 現 金 餘 額 ( 年 金 終 值 Type 0=> 期 末 支 付 1=> 期 初 支 付

Example YTM=2.83% 83%*2=5.66%

Bond A bond is a contact between the issue (boowe and the bondholde (lende. Bonds usually efe to long-tem debts. Callable bond, convetible bond. Pue discount bonds vs. level-coupon bond

Zeo-Coupon Bonds (Pue Discount Bonds The pice of a zeo-coupon bond that pays F dollas in n peiods is F P = ( 1+ whee is the inteest ate pe peiod No coupon is paid befoe bond matue. n Can meet futue obligations without einvestment isk. F (pa value P n peiods

Level-Coupon Bonds It pays inteest based on coupon ate and the pa value, which is paid at matuity. F denotes the pa value and C denotes the coupon. P = C (1 + 1 + C (1 + 2 +... + C (1 + n + F (1 + n

Picing of Level-Coupon Bonds P = = whee C (1 + nm i m + C C (1 + m 2 +... + F C (1 + 1 (1 + = C + F (1 + + nm m + i nm = 1 (1 + m (1 + m m (1 + n: time to matuity (in yeas m : numbe of payments pe yea. : annual ate compounded m times pe annum. C = Fc/m whee c is the annual coupon ate. m nm m nm F m nm (3.18 C C C C Pay m times F P Yea 1 Yea 2

Yield To Matuity The YTM of a level-coupon l bond dis its IRR when the bond is held to matuity. Fo a 15% BEY, a 10-yea bond with a coupon ate of 10% paid semiannually sells fo P = 5 5 100 +... +.15 0.15 20 0.15 (1 + 0 (1 + (1 + 2 ( 1+ (0.15 / 2 0.15 / 2 2 2 10 1 100 = 5 + 2 10 2 20 ( 1+ (0.15/ 2 = 74.5138

Yield To Call Fo a callable bond, the yield to states matuity measues es its yield to matuity ty as if wee e not callable. ab The yield to call is the yield to matuity satisfied by Eq(3.18, when n denoting the numbe of emaining coupon payments until the fist call date and F eplaced with call pice. C C F(call pice Pa value P A Company call the bonds Matuity

Homewok A company issues a 10-yea bond with a coupon ate of 10%, paid semiannually. The bond is called at pa afte 5 yeas. Find the pice that guaantees a etun of 12% compounded semiannually fo the investo. (You ae able to use Excel to un it.

Pice Behavios Bond pice falls as the inteest t ate inceases, and vice vesa. A level-coupon bond sells at a pemium (above its pa value when its coupon ate is above the maket inteest ate. at pa (at its pa value when its coupon ate is equal to the maket inteest ate. at a discount (below its pa value when its coupon ate is below the maket inteest ate.

Figue 3.8: Pice/yield elations Pemium bond Pa bond Discount bond

Figue 3.9: Pice vs. yield. Plotted is a bond that pays 8% inteest on a pa value of $1,000,compounding annually. The tem is 10 yeas.

Day Count Conventions: Actual/Actual The fist actual efes to the actual numbe of days in a month. The second efes to the actual numbe of days in a yea. Example: Fo coupon-beaing Teasuy secuities, the numbe of days between June 17, 1992, and Octobe 1, 1992, is 106. 13 days (June, 31 days (July, 31 days (August, 30 days (Septembe, and 1 day (Octobe.

Day Count Conventions:30/360 Each month has 30 days and each yea 360 days. The numbe of days between June 17, 1992, and Octobe 1, 1992, is 104. 13 days (June, 30 days (July, 30 days (August, 30 days (Septembe, and 1 day (Octobe. In geneal, the numbe of days fom date1 to date2 is 360 (y2 y1 + 30 (m2 m1 + (d2 d1 (y y ( ( Whee Date1 (y1,m1, d1 Date (y2,m2, d2

Bond pice between two coupon date (FllPi (Full Pice, Dity Pice Pi In eality, the settlement date may fall on any day between two coupon payment dates. C C 100 w 1 2 n Settlement date Numbe of days to the next payment date w = Numbe of days in the coupon peiod Dity Pice= C (1 + ω + C (1 + ω 1 +... + C ( 1+ ω n + 1+ 100 (1 + ω n + 1

Accued Inteest The oiginal bond holde has to shae accued inteest in 1-ω ω peiod - Accued inteest is C ( 1 ω The quoted pice in the U.S./U.K. does not include the accued inteest; it is called the clean pice. Dity pice= Clean pice+ Accued inteest

Example 3.5.3 Conside a bond with a 10% coupon ate, pa value$100 and paying inteest semiannually, with clean pice 111.2891. The matuity date is Mach 1, 1995, and the settlement date is July 1, 1993. The yield to matuity is 3%.

Example: solutions Thee ae 60 days between July 1, 1993, and the next coupon date, Septembe 1, 1993. The ω= 60/180, C=5,and accued inteest is 5 (1-(60/180 =3.3333 Dity pice=114.6224 clean pice = 111.2891 60 days 1993.3.1 settle 1993.9.1 1994.3.1 1994.9.1 1995.3.1

Execise 3.5.6 Befoe: A bond selling at pa if the yield to matuity equals the coupon ate. (But it assumed that the settlement date is on a coupon payment tdate. Now suppose the settlement date fo a bond selling at pa (i.e., the quoted pice is equal to the pa value falls between two coupon payment dates. Then its yield to matuity is less than the coupon ate. The shot eason: Exponential gowth is eplaced by linea gowth, hence ovepaying the coupon.

C++: fo 控 制 結 構 透 過 fo 的 結 構, 程 式 的 片 段 可 重 複 執 行 固 定 次 數 fo(int j=1;j<5;j=j+1 { j=1; pintf(" %d-th Execution\n",j; } 檢 視 :Bond Value poject 當 區 塊 中 只 有 一 行 敘 述 時, 左 右 括 弧 可 省 略 tue j<5 pintf(" %d-th Execution\n",j; j=j+1; Exit false

C++: 計 算 債 券 價 格 考 慮 債 券 價 格 的 計 算 假 定 單 期 利 率 為 每 一 期 支 付 coupon c, 共 付 n 期 到 期 日 還 本 100 元 100 c 1 2 3 n 債 券 價 格 P = c (1 + 1 + c (1 + 2 +... + c (1 + n + 100 (1 + n

i=1 程 式 想 法 i<=n false 列 印 價 格 tue 計 算 第 i 期 payoff 的 現 值 value=value+ value+ 第 i 期 的 現 值 i=i+1 int n; float c,, Value=0,Discount; scanf("%d",&n; scanf("%f",&c; scanf("%f",&; fo(int i=1;i<=n;i=i+1 { } pintf("bondvalue=%f",value;

計 算 第 i 次 payoff 的 現 值 i<n 現 值 = i=n 現 值 = 用 fo 計 算 (1 + i c ( 1+ n ( c + 100 (1+ 計 算 i (1+ i 考 慮 最 後 一 期 本 金 折 現 計 算 第 i 次 payoff 的 現 值 Discount=1; fo(int j=1;j<=i;j++ { Discount=Discount/(1+; } Value=Value+Discount*c; if(i==n { Value=Value+Discount*100; }

完 整 程 式 碼 ( 包 含 巢 狀 結 構 #include <stdio.h> void main( { int n; float c,, Value=0,Discount; scanf("%d",&n; scanf("%f",&c; scanf("%f",&; fo(int i=1;i<=n;i=i+1 { Discount=1; fo(int j=1;j<=i;j++ { Discount=Discount/(1+; } Value=Value+Discount*c; if(i==n { Value=Value+Discount*100; } } pintf("bondvalue=%f",value; } 第 i 次 payoff 的 現 值 Value 為 前 i 次 payoff 現 值

Homewok Pogam execise: Calculate the dity and the clean pice fo a bond unde actual/actual and 30/360 day count convesion. Input: Bond matuity date, settlement date, bond yield, and the coupon ate. The bond is assumed to pay coupons semiannually.