/// <summary>
        /// override the <method>DipathByAntitheticMethod</method>.
        /// For Black Scholes model, mu and sigma is constant, and only one random
        /// variate is needed to generate the state for next point
        /// </summary>

        public double[][] DipathByAntitheticMethod(StochasticAssetPrice S, GaussianGenerator nrandom,
                                                   double totalTime, int timeSteps, bool visualizationFlag = false, Form1 form = null)
        {
            double[][] pricePath = new double[2][];
            pricePath[0] = new double[timeSteps + 1];
            pricePath[1] = new double[timeSteps + 1];
            StochasticAssetPrice S2 = new StochasticAssetPrice(S);
            double dt = totalTime / (double)timeSteps;

            pricePath[0][0] = S.CurrentPrice;
            pricePath[1][0] = S.CurrentPrice;
            for (int i = 1; i <= timeSteps; i++)
            {
                double z  = nrandom.NextGaussian();
                double z2 = -z;
                pricePath[0][i] = GetNextPrice(S, dt, z);
                pricePath[1][i] = GetNextPrice(S2, dt, z2);
            }
            if (visualizationFlag & form != null)
            {
                double[] X = new double[timeSteps + 1];
                for (int i = 0; i <= timeSteps; i++)
                {
                    X[i] = i;
                }
                form.add(X, pricePath[0], "");
                form.add(X, pricePath[1], "");
            }
            return(pricePath);
        }
        /// <summary>
        /// override the <method>GeneratingRandomPricePath</method>.
        /// For Black Scholes model, mu and sigma is constant, and only one random
        /// variate is needed to generate the state for next point.
        /// </summary>

        public double[] GeneratingRandomPricePath(StochasticAssetPrice S, GaussianGenerator nrandom,
                                                  double totalTime, int timeSteps)
        {
            double[] pricePath = new double[timeSteps + 1];
            double   dt        = totalTime / (double)timeSteps;

            pricePath[0] = S.CurrentPrice;
            for (int i = 1; i <= timeSteps; i++)
            {
                double z = nrandom.NextGaussian();
                pricePath[i] = GetNextPrice(S, dt, z);
            }
            return(pricePath);
        }
 /// <summary>
 /// override the <method>DipathByAntitheticMethod</method>.
 /// For Black Scholes model, mu and sigma is constant, and only one random
 /// variate is needed to generate the state for next point
 /// </summary>
 public double[][] DipathByAntitheticMethod(StochasticAssetPrice S, GaussianGenerator nrandom,
     double totalTime, int timeSteps)
 {
     double[][] pricePath = new double[2][];
     pricePath[0] = new double[timeSteps + 1];
     pricePath[1] = new double[timeSteps + 1];
     StochasticAssetPrice S2 = new StochasticAssetPrice(S);
     double dt = totalTime / (double)timeSteps;
     pricePath[0][0] = S.CurrentPrice;
     pricePath[1][0] = S.CurrentPrice;
     for (int i = 1; i <= timeSteps; i++)
     {
         double z = nrandom.NextGaussian();
         double z2 = -z;
         pricePath[0][i] = GetNextPrice(S, dt, z);
         pricePath[1][i] = GetNextPrice(S2, dt, z2);
     }
     return pricePath;
 }
        /// <summary>
        /// override the <method>DipathByAntitheticMethod</method>.
        /// For Black Scholes model, mu and sigma is constant, and only one random
        /// variate is needed to generate the state for next point
        /// </summary>

        public double[][] DipathByAntitheticMethod(StochasticAssetPrice S, GaussianGenerator nrandom,
                                                   double totalTime, int timeSteps)
        {
            double[][] pricePath = new double[2][];
            pricePath[0] = new double[timeSteps + 1];
            pricePath[1] = new double[timeSteps + 1];
            StochasticAssetPrice S2 = new StochasticAssetPrice(S);
            double dt = totalTime / (double)timeSteps;

            pricePath[0][0] = S.CurrentPrice;
            pricePath[1][0] = S.CurrentPrice;
            for (int i = 1; i <= timeSteps; i++)
            {
                double z  = nrandom.NextGaussian();
                double z2 = -z;
                pricePath[0][i] = GetNextPrice(S, dt, z);
                pricePath[1][i] = GetNextPrice(S2, dt, z2);
            }
            return(pricePath);
        }
        /// <summary>
        /// override the <method>GeneratingRandomPricePath</method>.
        /// For Black Scholes model, mu and sigma is constant, and only one random
        /// variate is needed to generate the state for next point.
        /// </summary>

        public double[] GeneratingRandomPricePath(StochasticAssetPrice S, GaussianGenerator nrandom,
                                                  double totalTime, int timeSteps, bool visualizationFlag = false, Form1 form = null)
        {
            double[] pricePath = new double[timeSteps + 1];
            double   dt        = totalTime / (double)timeSteps;

            pricePath[0] = S.CurrentPrice;
            for (int i = 1; i <= timeSteps; i++)
            {
                double z = nrandom.NextGaussian();
                pricePath[i] = GetNextPrice(S, dt, z);
            }
            if (visualizationFlag & form != null)
            {
                double[] X = new double[timeSteps + 1];
                for (int i = 0; i <= timeSteps; i++)
                {
                    X[i] = i;
                }
                form.add(X, pricePath, "");
            }
            return(pricePath);
        }
 /// <summary>
 /// override the <method>DipathByAntitheticMethod</method>.
 /// For Black Scholes model, mu and sigma is constant, and only one random
 /// variate is needed to generate the state for next point
 /// </summary>
 public double[][] DipathByAntitheticMethod(StochasticAssetPrice S, GaussianGenerator nrandom,
     double totalTime, int timeSteps, bool visualizationFlag = false, Form1 form = null)
 {
     double[][] pricePath = new double[2][];
     pricePath[0] = new double[timeSteps + 1];
     pricePath[1] = new double[timeSteps + 1];
     StochasticAssetPrice S2 = new StochasticAssetPrice(S);
     double dt = totalTime / (double)timeSteps;
     pricePath[0][0] = S.CurrentPrice;
     pricePath[1][0] = S.CurrentPrice;
     for (int i = 1; i <= timeSteps; i++)
     {
         double z = nrandom.NextGaussian();
         double z2 = -z;
         pricePath[0][i] = GetNextPrice(S, dt, z);
         pricePath[1][i] = GetNextPrice(S2, dt, z2);
     }
     if (visualizationFlag & form != null)
     {
         double[] X = new double[timeSteps + 1];
         for (int i = 0; i <= timeSteps; i++)
         {
             X[i] = i;
         }
         form.add(X, pricePath[0], "");
         form.add(X, pricePath[1], "");
     }
     return pricePath;
 }
 /// <summary>
 /// override the <method>GeneratingRandomPricePath</method>.
 /// For Black Scholes model, mu and sigma is constant, and only one random
 /// variate is needed to generate the state for next point.
 /// </summary>
 public double[] GeneratingRandomPricePath(StochasticAssetPrice S, GaussianGenerator nrandom,
     double totalTime, int timeSteps, bool visualizationFlag = false, Form1 form = null)
 {
     double[] pricePath = new double[timeSteps + 1];
     double dt = totalTime / (double)timeSteps;
     pricePath[0] = S.CurrentPrice;
     for (int i = 1; i <= timeSteps; i++)
     {
         double z = nrandom.NextGaussian();
         pricePath[i] = GetNextPrice(S, dt, z);
     }
     if (visualizationFlag & form != null)
     {
         double[] X = new double[timeSteps + 1];
         for (int i = 0; i <= timeSteps; i++)
         {
             X[i] = i;
         }
         form.add(X, pricePath, "");
     }
     return pricePath;
 }
 /// <summary>
 /// override the <method>GeneratingRandomPricePath</method>.
 /// For Black Scholes model, mu and sigma is constant, and only one random
 /// variate is needed to generate the state for next point.
 /// </summary>
 public double[] GeneratingRandomPricePath(StochasticAssetPrice S, GaussianGenerator nrandom,
     double totalTime, int timeSteps)
 {
     double[] pricePath = new double[timeSteps + 1];
     double dt = totalTime / (double)timeSteps;
     pricePath[0] = S.CurrentPrice;
     for (int i = 1; i <= timeSteps; i++)
     {
         double z = nrandom.NextGaussian();
         pricePath[i] = GetNextPrice(S, dt, z);
     }
     return pricePath;
 }