#include <oxstd.h>
#include <quadpack.h>

output(const sFunc, const result, const abserr)
{
    print(sFunc, result, " abserr=", abserr, "\n");
}
mydensn(const x)
{
    return densn(x);
}
myfunc(const x)
{
	return exp(-x);
}
main()
{
    decl result, abserr, pn = probn(1) - probn(0);

    QNG(densn, 0.0, 1.0, &result, &abserr);
    output("QNG: ", result, abserr);

    QAG(densn, 0.0, 1.0, 5, &result, &abserr);
    output("QAG: ", result, abserr);

    QAG(densn, 0.0, 1.0, 15, &result, &abserr);
    output("QAG: ", result, abserr);

    QAGS(densn, 0.0, 1.0, &result, &abserr);
    output("QAGS:", result, abserr);

    QAGP(densn, 0.0, 1.0, <0.1,0.9>, &result, &abserr);
    output("QAGP:", result, abserr);

    QAGI(mydensn, 0, 1, &result, &abserr);
    output("QAGI:", result, abserr);

    print("using probn(): ", probn(1) - probn(0),
          " and ", probn(0), "\n");

	println("\nQAW? functions");
	QAWO(densn, 0, 10, 1, TRUE, 10, &result, &abserr);
    output("QAWO:", result, abserr);

	QAWS(densn, 0, 1, 1, 1, 1, &result, &abserr);
    output("QAWS:", result, abserr);

	QAWC(densn, 0, 1, 0.5, &result, &abserr);
    output("QAWC:", result, abserr);

	QPEPS(1e-8,1e-8);
	QAWF(myfunc, 0, 1, TRUE, 10, 10, &result, &abserr);
    output("QAWF:", result, abserr);
}

