#include "PDEBS.h" #include using namespace std; /* * Constructor for the Black-Scholes PDE solver. Parameters are the same names * as are documented in PDEBS.h. If s == 0.0, this signifies that the program * should use variable volatility, and you should set the rebuild flag to true * so that the operators can be reconstructed at each timestep. * * PDE's constructor is called implicitly in the initialisation list. Remember * to set initial and boundary conditions. */ PDEBS::PDEBS(int N, double dt, double a, double b, double theta, double s, double r, double K, bool call) : PDE(N, dt, a, b, theta) { // You need to fill in this function. } /* * If the rebuild flag is set, return the variable volatility sigma(S,t) * defined in the project formulation. Otherwise, return the constant * volatility this -> s. */ inline double PDEBS::sigma(double x, double t) { // You need to fill in this function. } /* * Sets the boundary conditions for this PDE. If call is true, return a call * boundary condition; otherwise return a put. */ void PDEBS::setBC() { // You need to fill in this function. } /* * Sets the initial condition for this PDE. If call is true, return a call * initial condition; otherwise return a put. */ void PDEBS::setIC() { // You need to fill in this function. } /* * Sets the operators this->le (differential operator at time n) and this->li * (differential operator at time n+1). Remember to leave the first and last * rows of these matrices set to zero. */ void PDEBS::setOperator() { // You need to fill in this function. }