/* * diff_BDT.cpp * * Created on April 11, 2006, 2:25 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ #include #include #include #include #include #include "diff.cpp" using namespace std; /** The Black Derman Toy interest rate model in differential form, * where r is the short term risk free rate of return, * dt is the time step differential, * r is pulled back to the theta(t) level at a rate of alpha, * a represents the function a(r)=alpha(mu-r) used in * the SDEIntegrator. The first derivative of a, d_a = -alpha. * The sde is an SDEIntegrator used to find r(t+delta_t), where * the function b(r,t) is the constant sigma */ class diff_BDT : public diff{ /** * Creates a new instance of diff_BDT with * default values */ public: diff_BDT::diff_BDT() { } /** * Creates a new instance of diff_BDT */ public: diff_BDT::diff_BDT(double _dt,double _mu,double _alpha, double _sigma, double _r0) { } /** sets the a(r) function used in the SDEIntegrator for the particular case of the Cox Ingersoll Ross Model */ public: void diff_BDT::set_a(){ a=yield_prime[index]/yield[index] + d_b/b*log(r); sde.set_a(a); } public: void diff_BDT::set_d_a(){ d_a=0.0; sde.set_d_a(d_a); } public: void diff_BDT::set_dd_a(){ dd_a=0.0; sde.set_dd_a(dd_a); } /** sets the b(r,t) function used in the SDEIntegrator*/ public: void diff_BDT::set_b(){ b = sigma[index]; sde.set_b(b); } /** sets the db(r,t)/dr function used in the SDEIntegrator */ public: void diff_BDT::set_d_b(){ d_b = sigma_prime[index]; sde.set_d_b(d_b); } /** sets the d^2b(r,t)/dr^2 function used in the SDEIntegrator*/ public: void diff_BDT::set_dd_b(){ dd_b = 0.0; sde.set_dd_b(dd_b); } /** sets the d^3b(r,t)/dr^3 function used in the SDEIntegrator*/ public: void diff_BDT::set_ddd_b(){ ddd_b = 0.0; sde.set_ddd_b(ddd_b); } };