public static double p04_q(ref typeMethods.r8ErrorData data, ref typeMethods.r8ErrorcData cdata, int m, double[] c, double[] w)
//****************************************************************************80
//
//  Purpose:
//
//    P04_Q evaluates the integral for problem p04.
//
//  Licensing:
//
//    This code is distributed under the GNU LGPL license.
//
//  Modified:
//
//    29 August 2012
//
//  Author:
//
//    John Burkardt
//
//  Reference:
//
//    Alan Genz,
//    A Package for Testing Multiple Integration Subroutines,
//    in Numerical Integration: Recent Developments, Software
//    and Applications,
//    edited by Patrick Keast and Graeme Fairweather,
//    Reidel, 1987, pages 337-340,
//    ISBN: 9027725144,
//    LC: QA299.3.N38.
//
//  Parameters:
//
//    Input, int M, the dimension of the argument.
//
//    Input, double C[M], W[M], the problem parameters.
//
//    Output, double P04_Q, the integral.
//
    {
        double q = 1.0;

        for (int i = 0; i < m; i++)
        {
            q = q * Math.Sqrt(Math.PI)
                * (typeMethods.r8_error(ref data, ref cdata, c[i] * (1.0 - w[i]))
                   + typeMethods.r8_error(ref data, ref cdata, c[i] * w[i]))
                / (2.0 * c[i]);
        }

        return(q);
    }
    public static double p00_q(ref typeMethods.r8ErrorData data, ref typeMethods.r8ErrorcData cdata, int prob, int m, double[] c, double[] w)
//****************************************************************************80
//
//  Purpose:
//
//    P00_Q returns the integral of any function.
//
//  Licensing:
//
//    This code is distributed under the GNU LGPL license.
//
//  Modified:
//
//    29 August 2012
//
//  Author:
//
//    John Burkardt
//
//  Parameters:
//
//    Input, int PROB, the index of the function.
//
//    Input, int M, the spatial dimension.
//
//    Input, double C[M], W[M], the problem parameters.
//
//    Output, double P00_Q, the integral.
//
    {
        double q;

        switch (prob)
        {
        case 1:
            q = p01_q(m, c, w);
            break;

        case 2:
            q = p02_q(m, c, w);
            break;

        case 3:
            q = p03_q(m, c, w);
            break;

        case 4:
            q = p04_q(ref data, ref cdata, m, c, w);
            break;

        case 5:
            q = p05_q(m, c, w);
            break;

        case 6:
            q = p06_q(m, c, w);
            break;

        default:
            Console.WriteLine("");
            Console.WriteLine("P00_Q - Fatal error!");
            Console.WriteLine("  Illegal function index PROB = " + prob + "");
            return(1);
        }

        return(q);
    }