How do i calculate the number of subintervals n in Midpoint method?

258 Views Asked by At

I want to calculate the least error (o) in order to obtain the exact answer for integration using the midpoint method. However I am having trouble doing so since i was given a functions whose second derivative is zero.

For example, let's say we are given f(x)=3x calculate the integral in [0,1]. also note that h=1/n. We need to find n. How many values of n (i.e. subintervals) do u need to find the exact answer to the integral using the midpoint method. To do so, note that the error term for midpoint method is:

(1/24)(b-a)(h^2)f^2(c) = zero (for exact answer)

where c is some constant.

My thought process:

b=1,a=0 note: h=1/n

the second derivative of 3x is 0

but i must solve the equation above for h. How would i bound f^2(c) so that i can solve for h to find the exact answer i need? I thought that since f^2(c)=0, then it is <1 so i can treat f^2(c) as 1 as a bound. then: (1/24)(b-a)(h^2)f^2(c) = (1/24)(1)(h^2)(1)= (1/24)*(h^2)=0

h=0 but this doesn't seem correct since i cannot solve h=1/n now.

Am i doing this correctly? I know I'm incorrect because i tried solving this numerically in matlab and it took forever for the midpoint method to converge so i know n must be large.

1

There are 1 best solutions below

0
On

In this case you can get by with the minimum amount of intervals, exactly one. Obviously, $h=b-a$.