Black Scholes equation initial conditions in c++

Hello everyone ,
I am trying to write the initial conditions of my black scholes call option equation at the same format of c++ , I am still new to this programming language .
here is a small example of a burger eq. initial conditions


numBoundaryConditionPoints = [25 25];

x0BC1 = -1*ones(1,numBoundaryConditionPoints(1));
x0BC2 = ones(1,numBoundaryConditionPoints(2));

t0BC1 = linspace(0,1,numBoundaryConditionPoints(1));
t0BC2 = linspace(0,1,numBoundaryConditionPoints(2));

u0BC1 = zeros(1,numBoundaryConditionPoints(1));
u0BC2 = zeros(1,numBoundaryConditionPoints(2));

numInitialConditionPoints = 50;

x0IC = linspace(-1,1,numInitialConditionPoints);
t0IC = zeros(1,numInitialConditionPoints);
u0IC = max(x-k,0);

X0 = [x0IC x0BC1 x0BC2];
T0 = [t0IC t0BC1 t0BC2];
U0 = [u0IC u0BC1 u0BC2];

numInternalCollocationPoints = 10000;

pointSet = sobolset(2);
points = net(pointSet,numInternalCollocationPoints);

dataX = 2*points:),1)-1;
dataT = points:),2);

ds = arrayDatastore([dataX dataT]);

how do you think we should represent BS initial conditions in this script?
Thank you :)
 

Daniel Duffy

C++ author, trainer
Hello everyone ,
I am trying to write the initial conditions of my black scholes call option equation at the same format of c++ , I am still new to this programming language .
here is a small example of a burger eq. initial conditions


numBoundaryConditionPoints = [25 25];

x0BC1 = -1*ones(1,numBoundaryConditionPoints(1));
x0BC2 = ones(1,numBoundaryConditionPoints(2));

t0BC1 = linspace(0,1,numBoundaryConditionPoints(1));
t0BC2 = linspace(0,1,numBoundaryConditionPoints(2));

u0BC1 = zeros(1,numBoundaryConditionPoints(1));
u0BC2 = zeros(1,numBoundaryConditionPoints(2));

numInitialConditionPoints = 50;

x0IC = linspace(-1,1,numInitialConditionPoints);
t0IC = zeros(1,numInitialConditionPoints);
u0IC = max(x-k,0);

X0 = [x0IC x0BC1 x0BC2];
T0 = [t0IC t0BC1 t0BC2];
U0 = [u0IC u0BC1 u0BC2];

numInternalCollocationPoints = 10000;

pointSet = sobolset(2);
points = net(pointSet,numInternalCollocationPoints);

dataX = 2*points:),1)-1;
dataT = points:),2);

ds = arrayDatastore([dataX dataT]);

how do you think we should represent BS initial conditions in this script?
Thank you :)
?? what is this?? Matlab?
 
Top