예제 #1
0
        public void Setup(double[] SimulationDates)
        {
            double dt = SimulationDates[1] - SimulationDates[0];//assumes constant dt

            a = Math.Exp(-lambda.fV() * dt);
            b = mu.fV() * (1 - Math.Exp(-lambda.fV() * dt));
            c = sigma.fV() * Math.Sqrt((1 - Math.Exp(-2 * lambda.fV() * dt)) / (2 * lambda.fV()));
        }
예제 #2
0
 public void Simulate(double[] Dates, IReadOnlyMatrixSlice Noise, IMatrixSlice OutDynamic)
 {
     OutDynamic[0, 0] = spot.fV();
     for (int i = 1; i < Dates.Length; i++)
     {
         OutDynamic[i, 0] = a * OutDynamic[i - 1, 0] + b + c * Noise[i - 1, 0];
     }
 }