I think I have a good starting point on this, but I still need some help :)

First I need to ask the user for the limits of integration and the error tolerance, (that's already done).

So when I divide the trapezoid (when the end points are connected) in 2, I get a better approximation, so based on the error tolerance I need to keep dividing the 2 trapezoids on each side of the midpoint. For example if the entered tolerance is 0.5, the error tolerance on each side of the midpoint is 0.25. Now I made a separate function for calculating the function, so I just need to figure out how to write this function recursively. The area of the 1st trapezoid, before dividing it is

(b-a)(F(b)+F(a)/2. Since it's recursion I know it has to have a starting point, check if it is the answer I need and continue dividing, but I don't know how to write the stopping point based on the tolerance. And at the end it will return itself. Hopefully someone will have the patience to read and help me! Thank you!

0