0

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)```
AcK
  • 2,063
  • 2
  • 20
  • 27
Or Meiri
  • 1
  • 1
  • What exactly is the problem with the code you have shown? – mkrieger1 Feb 07 '21 at 09:13
  • Make a function table of the interval, test where `f1(x)>f2(x)`, and where it flips, then apply your favorite bracketed root solver, bisection, illinois, dekker, to find the roots of `f1(x)-f2(x)=0` – Lutz Lehmann Feb 07 '21 at 09:32
  • I don't have a problem with this code in specific. I am treing to understand how to find the erea between two function with simpson method. I don't understand how do i incloude all the intercepts if i have infint number of intercepts. – Or Meiri Feb 07 '21 at 10:50

0 Answers0