Jean-Pierre Avermaete
Reputation
Top tag
Next privilege 75 Rep.
Set bounties
 Apr 25 awarded Teacher Apr 25 awarded Student Apr 23 awarded Editor Apr 21 awarded Citizen Patrol Apr 21 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon @kguler, thanks for the way to see which of both functions is the fastest, but the first version (with Piecewise) doesn't work at all. That's to problem ! Apr 20 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon @Eli Lansey, That's what I get : FindRoot[TimeValue[{"FaceValue" -> 100, "Coupon" -> (Piecewise[{{0.04125, #1 <= 3}, {0.06, 3 < #1 <= 5}, {0.0775, 5 < #1 <= 7}}] &), "Maturity" -> 7}, {"InterestRate" -> r, "Settlement" -> 0}] == 102.35, {r, 0.05}] FindRoot::nlnum: The function value {-102.35+TimeValue[{FaceValue->100.,Coupon->(Piecewise[{<<3>>}]&),Maturity->7.},‌​{InterestRate->0.05,Settlement->0.}]} is not a list of numbers with dimensions {1} at {r} = {0.05}. >> Apr 20 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon kguler & Eli Lansey, I've tried once again your approach, but it doesn't work. I still get the same error message I mentioned before. How can you say that it's about ten times faster when it doesn't work ? Can you send me the exact formulation so I can test it ? Apr 19 answered How do I define the “Coupon” within the function FinancialBond with a time-varying coupon Apr 18 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon Sorry again, I'm not accustomed with the return button ;o) FindRoot[FinancialBond[{"FaceValue"->100,"Coupon"->5,"Maturity"->5},{"InterestRa‌​te"->r,"Settlement"->0}]==104.25,{r,0.05}] gives the answer : {r->0.04415}. I want to be able to do it the same way but with a gradual coupon, so I can derive with the property "Rules" all the other characteristics (duration, convexity and so on). Is it possible ? Apr 18 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon An example, Eli, with a constant coupon : Apr 18 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon Sorry, I post it to quickly. When I try to solve the function sent before, this is the error message I get : FindRoot::nlnum: "The function value \!({(-104.25\) + FinancialBond[{\"FaceValue\" -> 100., \"Coupon\" -> Piecewise[{<<3>>}] &, \"Maturity\" -> 7.}, {\"InterestRate\" -> 0.05, \"Settlement\" -> 0.}]}\) is not a list of numbers with dimensions {1} at {r} = {0.05}." and nothing happens. When I use your Piecewise solution and give the appropriate yield, the function doesn't work either. Apr 18 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon FindRoot[FinancialBond[{"FaceValue" -> 100, "Coupon" -> Piecewise[{{.04125, #1 <= 3}, {.06, 3 < #1 <= 5}, {.0775, 5 < #1 <= 7}}] &, "Maturity" -> 7}, {"InterestRate" -> r, "Settlement" -> 0}] == 104.25, {r, 0.05}] Apr 18 comment How do I define the “Coupon” within the function FinancialBond with a time-varying coupon This is not what I need. I'm not talking about an interest specification, but about a coupon changing over time. How do I define the time-dependent coupon ? As a list, it should be {.04125,.04125,.04125,.06,.06,.0775,.0775}. How get I such a list in "Coupon" ->... The purpose is to calculate the yield of such a bond using FindRoot[...] where within the function FinancialBond, the "InterestRate"->r (unknown) and the FindRoot equals 1.0425 or 1042.5 if I start with a FaceValue of 1,000. That's my problem. Apr 18 asked How do I define the “Coupon” within the function FinancialBond with a time-varying coupon