# Numerical Analysis/Romberg Example

Use Romberg Integration to compute ${\displaystyle R_{3,3}}$ for the following integral
${\displaystyle \int _{0}^{\frac {\pi }{2}}cosx\,dx}$

Solution:

${\displaystyle R_{1,1}={\frac {\pi }{4}}[cos(0)+cos({\frac {\pi }{2}})]}$

${\displaystyle R_{1,1}={\frac {\pi }{4}}}$

${\displaystyle R_{2,1}=\left({\frac {1}{2}}\right)[R_{1,1}+h_{1}f(a+h_{2})]}$

${\displaystyle R_{2,1}=\left({\frac {1}{2}}\right)[{\frac {\pi }{4}}+{\frac {\pi }{2}}cos\left({\frac {\pi }{4}}\right)]}$
${\displaystyle R_{2,1}=1.178023457}$

${\displaystyle R_{3,1}=\left({\frac {1}{2}}\right)[R_{2,1}+h_{2}(f(a+h_{3})+f(a+3h_{3}))]}$
${\displaystyle R_{3,1}=\left({\frac {1}{2}}\right)[1.178023457+{\frac {\pi }{4}}(cos({\frac {\pi }{8}})+cos({\frac {3\pi }{8}})]}$
${\displaystyle R_{3,1}=1.374317658}$

${\displaystyle R_{2,2}=R_{2,1}+{\frac {R_{2,1}-R_{1,1}}{4-1}}}$
${\displaystyle R_{2,2}=1.178023457+{\frac {.3926252936}{3}}}$
${\displaystyle R_{2,2}=1.308898555}$

${\displaystyle R_{3,2}=R_{3,1}+{\frac {R_{3,1}-R_{2,1}}{4-1}}}$
${\displaystyle R_{3,2}=1.374317658+{\frac {.196294201}{3}}}$
${\displaystyle R_{3,2}=1.439749058}$

${\displaystyle R_{3,3}=R_{3,2}+{\frac {R_{3,2}-R_{2,2}}{16-1}}}$
${\displaystyle R_{3,3}=1.439749058+{\frac {.1308505033}{15}}}$
${\displaystyle R_{3,3}=1.448472425}$