I am trying to perform the Gram--Schmidt orthogonalization on a set of continuos complex functions. Numerical solution would be quite sufficient for me.
I have three continuous functions of complex argument on $[0,\pi]$:
$$ f_1(x) = \sin(x) \\ f_2(x) = \sin(2x) \\ f_3(x) = \sin(3x) \\ $$
These are obviously orthogonal and I have checked that my Maple and Octave algorithms confirm that.
However, even a slight detour to the complex plane ruins the final set orthogonality. For example:
$$ f_1(x) = \sin(x - 0.01\mathrm{i}x) \\ f_2(x) = \sin(2x) \\ $$
Then by the modified Gram-Schmidt:
$$ g_1 = \frac{f_1}{\sqrt{\langle f_1,f_1\rangle}} \\ g_2 = f_2 - \langle g_1,f_2\rangle g_1 \\ g_2 := \frac{g_2}{\sqrt{\langle g_2,g_2\rangle}} $$
where ${\langle r,s \rangle} = \int_0^\pi fg^* \mathrm{d}x$.
Yet only the real part of ${\langle g_1,g_2 \rangle}$ is zero (to the machine precision). The imaginary part is non-vanishing. Since I have tried the same procedure in Maple as well as in Octave obtaining the same results (I mean exactly the same, no implementation bias) I must be missing something more fundamental. Any help and/or hints, please?