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):
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:
n | m | result |
1 | 1 | 1.000000000028582026 |
1 | 2 | -0.000000000000000116 |
1 | 3 | 0.000000000000000170 |
3 | 3 | 1.000000000028582026 |
3 | 5 | -0.000000000000000028 |
5 | 5 | 1.000000000028582026 |
Q.E.D.