Ok I'm finished implementing the parameter estimation. Here's the problem: I'm providing excellent initial parameters for everything except the mean functional coefficients a and b and yet I am getting horrible estimates for everything, especially amplitudes. I think the reason is that my error metric is nonsensical. I think that needs to be fixed.