Orthogonal Functions - basis of the Fourier Transform



From "Introduction to Communication Systems" (Stremler):

   We can easily show that the functions sin(nπt) and sin (mπt) are orthonogal over the interval (0,2):

   absin(nπt)sin(mπt) dt
   is 1 for n = m, and 0 for n ≠ m

Just to verify this we can use the numerical integration section of the GNU Scientific Library, like this:

#include <stdio.h>
#include <math.h>
#include <gsl/gsl_integration.h>

#define PI 3.14159265358979

double f (double x, void * params) {
  double f = sin(2 * PI * x) * sin(2 * PI * x);
  return f;
}

int
main (void)
{
  gsl_integration_workspace * w
    = gsl_integration_workspace_alloc (1000);

  double result, error;

  gsl_function F;
  F.function = &f;

  gsl_integration_qags (&F, 0, 2, 1e-3, 1e-3, 1000,
                        w, &result, &error);

  printf ("result          = % .18f\n", result);
  printf ("estimated error = % .18f\n", error);
  printf ("intervals =  %d\n", w->size);

  return 0;
}


by simply changing n & m to a few representative values, recompiling and running. Doing so, we get:

nmresult
111.000000000028582026
12-0.000000000000000116
130.000000000000000170
331.000000000028582026
35-0.000000000000000028
551.000000000028582026


Q.E.D.