/* Macsyma commands to find interest-rate derivative scenarios allowed by the binomial pricing model for P(0,2) using the Ho and Lee or Black, Derman, and Toy methods. Examples 3.14 and 3.15 from "Binomial Models in Finance," pp.57--59 Binomial pricing model for zero coupon bond P(0,2) in Eq.3.24 and Eq.3.25 on p.57. Usage: Copy and paste this entire file into the Macsyma console. M.V.Wickerhauser, 2019-09-16 */ /* Binomial pricing formula for P(0,2) using Ho and Lee relation R(1,up) = k*R(1,down) with values from Example 3.14 */ eqHoLee: P02=(1/R)*(pi+k*(1-pi))/R1u; /* Eq.3.25 with R1d=R1u/k */ HoLee:solve(eqHoLee,R1u); /* Solve for R1u */ /* Evaluate R1u and R1d using the values given in the example: */ HoLeeR1u: ev(HoLee, P01:0.95, R:1/0.95, P02:0.90, pi:0.5, k:1.04); HoLeeR1d: ev(R1d:R1u/k, HoLeeR1u,k:1.04); /* Binomial pricing formula for P(0,2) using Black, Derman, and Toy relation r(1,up) = sigma(1)*r(1,down) with values from Example 3.15 */ /* Eq.3.25 with r1u=sig1*r1u */ eqBlackDermanToy: P02=(1/R)*(pi/(1+sig1*r1d)+(1-pi)/(1+r1d)); BlackDermanToy: solve(eqBlackDermanToy, r1d); /* Solve for r1d */ /* Evaluate r1d and r1u using the values given in the example: NOTE: there will be two roots r1d. Reject the negative root. */ BlackDermanToyr1d: ev(BlackDermanToy, R:1/0.95,P02:0.90,pi:0.5,sig1:1.1); BlackDermanToyr1u: ev(r1u:BlackDermanToyr1d*sig1, sig1:1.1);