Hi,
I would like to integrate a function f(x,y) with respect to x. In the examples, I didn't find something like that. For example, how can I modify the D1 example to integrate exp(x*z) instead, where z is an additional parameter to the function int_function_1_func ? (see below)
I know this should be a trivial question, but any help would be welcome, as I'm not familiar with alglib or C++.
Many thanks in advance.
void int_function_1_func(double x, double xminusa, double bminusx, double &y, void *ptr) { // this callback calculates f(x)=exp(x) y = exp(x); }
int main(int argc, char **argv) { // // This example demonstrates integration of f=exp(x) on [0,1]: // * first, autogkstate is initialized // * then we call integration function // * and finally we obtain results with autogkresults() call // double a = 0; double b = 1; autogkstate s; double v; autogkreport rep;
autogksmooth(a, b, s); alglib::autogkintegrate(s, int_function_1_func); autogkresults(s, v, rep);
printf("%.2f\n", double(v)); // EXPECTED: 1.7182 return 0; }
|