6
$\begingroup$

I'm doing a project on numerical integration in Matlab and I'm looking for some nice things to program.

So far, I programmed:

  • Trapezium rule
  • Simpson rule
  • Double integral over a rectangle
  • Estimating $\pi$ using the integral $$\int\limits_0^{1}\frac{4dx}{1+x^2}$$

Do you know any other things that involve integrals and are not too hard to program (I am a first year university undergraduate). Any ideas are welcome. I'm aware that this is a subjective question, but I'm interested in all kind of things.

Thanks in advance.

$\endgroup$

3 Answers 3

3
$\begingroup$

First of all: In this context the integration is very often referred to as quadrature (just an old term).

A fun project you might want to try is adaptive quadrature. There are many ways to achieve that, but the rough idea is that you add more nodes where your current approximation is not good enough. (You make a finer grid where the function is "wild".)

$\endgroup$
1
  • $\begingroup$ Looks interesting. I will take a look at it! Thank you! $\endgroup$
    – user370967
    Mar 26, 2017 at 21:04
1
$\begingroup$

Trapezium and Simpson rules are Gaussian quadrature both but with different number of nodes. There are another quadrature rules. For example Newton's quadrature.

Another and more interesting method (in my opinion) is Spline quadrature method where integrating function is being replaced with spline, $S_3^1$ for example. The main difference from standard quadrature is that the final formula contains not only the values of function, it contains the values of second spline derivative too.

$\displaystyle\int\limits_a^b f(x)dx \approx \sum\limits_{i=1}^N\left( h_i\frac{f_i+f_{i-1}}{2} - h_i^3\frac{M_i+M_{i-1}}{24} \right)$

Where $h_i = x_i-x_{i-1}$ and $M_i = S''(x_i)$ - spline's second derivative.

$\endgroup$
1
$\begingroup$

Adaptive quadrature, as someone mentioned already, is definitely worthwhile to try. Something else you might consider trying out is Monte Carlo integration which is pretty good for complicated domains and high-order integrals.

$\endgroup$