Hello. I need to write a program to evaluate a definite integral with Simpson's composite rule.

I know there is a Simpson's rule available in Scipy, but I really need to write it by the following scheme.

- ,

where a, b - limits of integral, n-number of intervals of integral's partition.

for k-even

and

for k-uneven

I already got this far (see below), but my answer is not correct. The output of my code is equal 0.07. But answer of WolphramAlpha that uses identical algorithm is 0.439818.

(WolframAlpha result)

What should I change for in my code? Any help will be appreciated.

```
#include <iostream.h>
#include <math.h>
#include <conio.h>
using namespace std;
double f(double x) {
return ((0.6369)*sin(sin(x))*sin(x));
}
int main() {
double a = 0.0;
double b = 1.57;
double n = 2.0;
double eps = 0.1;
double h = (b-a)/(2*n);
double s = f(a) + f(b);
int k = 1;
int x;
double i;
while (k>(2*n)-1) {
x = a+h*k;
s = s+4*f(x)+2*f(x+h);
k = k+2;
}
i = s*h/3;
cout << "integral is equal " << i;
cout << "\nPress any key to close";
getch();
return 0;
}
```