-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpde.h
More file actions
40 lines (30 loc) · 1.1 KB
/
pde.h
File metadata and controls
40 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __PDE_H
#define __PDE_H
#include "option.h"
// Convection Diffusion Equation - Second-order PDE
class ConvectionDiffusionPDE {
public:
// PDE coefficients
virtual double diff_coeff(double t, double x) const = 0;
virtual double conv_coeff(double t, double x) const = 0;
virtual double zero_coeff(double t, double x) const = 0;
virtual double source_coeff(double t, double x) const = 0;
// Boundary and initial conditions
virtual double boundary_left(double t, double x) const = 0;
virtual double boundary_right(double t, double x) const = 0;
virtual double init_cond(double x) const = 0;
};
class BlackScholesPDE : public ConvectionDiffusionPDE {
public:
VanillaOption* option;
BlackScholesPDE(VanillaOption* _option);
virtual ~BlackScholesPDE() {};
double diff_coeff(double t, double x) const;
double conv_coeff(double t, double x) const;
double zero_coeff(double t, double x) const;
double source_coeff(double t, double x) const;
double boundary_left(double t, double x) const;
double boundary_right(double t, double x) const;
double init_cond(double x) const;
};
#endif