Integrating between two function with simpson rule

104 Views Asked by At

I have a numerical problem. I need to calculate the integral between two functions f1 and f2. I already have the simpson rule for one function. I need help how to find the intercepts between the two function and calculate the integral.

        F0 = f(a)
        F1 = 0
        F2 = f(b)
        for i in range(n):
            x = a + i * h
            if x % 2 == 0:
                F2 += f(x)
                F0 += f(x)
            else:
                F1 += f(x)
        inter = (h / 3) * (F0 + 4 * F1 + F2)```
0

There are 0 best solutions below