示例#1
0
    private static void test01()

    //****************************************************************************
    //
    //  Purpose:
    //
    //    TEST01 tests BPATH.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    23 September 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int n = 500;

        Console.WriteLine("");
        Console.WriteLine("TEST01:");
        Console.WriteLine("  BPATH generates a sample Brownian motion path.");

        int seed = 123456789;

        typeMethods.r8vecNormalData data = new();

        double[] w = BrownianPath.bpath(ref data, ref seed, n);

        BrownianPath.bpath_gnuplot(n, w);
    }
示例#2
0
    private static void test02()

    //****************************************************************************
    //
    //  Purpose:
    //
    //    TEST02 tests BPATH_AVERAGE.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    23 September 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double    error = 0;
        const int m     = 1000;
        const int n     = 500;

        Console.WriteLine("");
        Console.WriteLine("TEST02:");
        Console.WriteLine("  BPATH_AVERAGE generates many Brownian paths");
        Console.WriteLine("  and averages them.");

        int seed = 123456789;

        typeMethods.r8vecNormalData data = new();
        double[] u     = new double[m * (n + 1)];
        double[] umean = new double[n + 1];

        BrownianPath.bpath_average(ref data, ref seed, m, n, ref u, ref umean, ref error);

        BrownianPath.bpath_average_gnuplot(m, n, u, umean);
    }