Пример #1
0
    public static void bivariate_normal_cdf_values_test( )
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    BIVARIATE_NORMAL_CDF_VALUES_TEST tests BIVARIATE_NORMAL_CDF_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    23 May 2009
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double fxy = 0;
        double r   = 0;
        double x   = 0;
        double y   = 0;

        Console.WriteLine("");
        Console.WriteLine("BIVARIATE_NORMAL_CDF_VALUES_TEST:");
        Console.WriteLine("  BIVARIATE_NORMAL_CDF_VALUES stores values of");
        Console.WriteLine("  the bivariate normal CDF.");
        Console.WriteLine("");
        Console.WriteLine("      X            Y            R            F(R)(X,Y)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Bivariate.bivariate_normal_cdf_values(ref n_data, ref x, ref y, ref r, ref fxy);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + x.ToString(CultureInfo.InvariantCulture).PadLeft(12) + "  "
                              + y.ToString(CultureInfo.InvariantCulture).PadLeft(12) + "  "
                              + r.ToString(CultureInfo.InvariantCulture).PadLeft(12) + "  "
                              + fxy.ToString("0.################").PadLeft(24) + fxy + "");
        }
    }
Пример #2
0
    private static void test02()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST02 tests BIVNOR.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    13 April 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double fxy1 = 0;
        double r    = 0;
        double x    = 0;
        double y    = 0;

        bivariatenormal.BivnorData data = new();

        Console.WriteLine("");
        Console.WriteLine("TEST02");
        Console.WriteLine("  Compare BIVNOR with some tabulated data.");
        Console.WriteLine("");
        Console.WriteLine("      X          Y          " +
                          "R           P                         P" +
                          "                      DIFF" +
                          "                                " +
                          "       (Tabulated)               (BIVNOR)");
        Console.WriteLine("");

        int n_data = 0;

        for (;;)
        {
            Bivariate.bivariate_normal_cdf_values(ref n_data, ref x, ref y, ref r, ref fxy1);

            if (n_data == 0)
            {
                break;
            }

            //
            //  BIVNOR computes the "tail" of the probability, and we want the
            //  initial part//
            //
            double fxy2 = bivariatenormal.bivnor(ref data, -x, -y, r);

            Console.WriteLine("  " + x.ToString(CultureInfo.InvariantCulture).PadLeft(8)
                              + "  " + y.ToString(CultureInfo.InvariantCulture).PadLeft(8)
                              + "  " + r.ToString(CultureInfo.InvariantCulture).PadLeft(8)
                              + "  " + fxy1.ToString(CultureInfo.InvariantCulture).PadLeft(24)
                              + "  " + fxy2.ToString(CultureInfo.InvariantCulture).PadLeft(24)
                              + "  " + Math.Abs(fxy1 - fxy2).ToString(CultureInfo.InvariantCulture).PadLeft(10) + "");
        }
    }