4.10 Romberg Integration

Using Richardson Extrapolation (a deffered approach to the limit)

h1=(ba),h2=(ba)2,,hn=(ba)2n1

I1=(ba)2(f(a)+f(b))In+1=In2+hn+12n1i=1f(a+(2i1)hn+1)Ri,1=IiRi,j=Ri,j1+Ri,j1Ri1,j14j11

Rn,n is the answer!

Practice script

romb
## function (fx, a, b, N = 4) 
## {
##     R = matrix(nrow = N, ncol = N)
##     h = b - a
##     R[1, 1] = h/2 * (fx(a) + fx(b))
##     np = 1
##     for (i in 2:N) {
##         h = h/2
##         np = 2 * np
##         R[i, 1] = 1/2 * R[i - 1, 1] + h * sum(fx(a + h * seq(1, 
##             np - 1, 2)))
##         for (j in 2:i) {
##             R[i, j] = R[i, j - 1] + (R[i, j - 1] - R[i - 1, j - 
##                 1])/(4^(j - 1) - 1)
##         }
##     }
##     return(R[N, N])
## }
## <bytecode: 0x000001e2a3f4fd98>
## <environment: namespace:math>
fx = function(x) exp(-x/100)
format(romb(fx, 0, 24), digits=22)
## [1] "21.33721389334470330823"
fx2 = function(x) 3 * x * sin(x) - log(x)
format(romb(fx2, 0.8, 2.6), digits=22)
## [1] "6.887425952851619292971"
format(romb(fx2, 0.8, 2.6, N=8), digits=22)
## [1] "6.887419623354108288993"