3 #include <ginac/ginac.h>
5 // Yes, we are using CUBA (should be installed on the system!)
10 // Let the user enter a expression
11 symbol x("x"), y("y");
13 cout << "Enter an expression containing 'x' and/or 'y': ";
15 // Expression now in expr
18 cout << "start integration of " << expr << " ..." << endl;
20 // Some definitions for VEGAS
31 // Some variables for VEGAS
32 int comp, nregions, neval, fail;
33 double integral[NCOMP], error[NCOMP], prob[NCOMP];
36 // By invocation of compile() the expression in expr is converted into the
37 // appropriate function pointer
38 Vegas(NDIM, NCOMP, compile(lst(expr), lst(x,y)), EPSREL, EPSABS, VERBOSE,
39 MINEVAL, MAXEVAL, NSTART, NINCREASE, &neval, &fail, integral, error, prob);
42 cout << "result: " << integral[0] << endl;