Compute the Macaulay and modified duration of a bond from its cash flows.
Macaulay 久期 = 各期現金流現值乘以其時間 t 之和除以債券價格;修正久期 = Macaulay 除以 (1+每期收益率),表示收益率變動 1% 時價格變動的百分比。