Create a c++ function which will fit a sine curve to a set of xy pairs.
(1)The code should be written in standard c++ and MUST compile under Borland C++ Builder (the former does not necessarily imply the latter (but probably will)).
2) Create a C++ function, SinFit which, when provided with a set of xy pairs, will calculate and return the parameters a, b, c and d represented in the equation **y = [login to view URL](bx+c)+d**. In addition, the function will return a quality of fit such as a correlation coefficient.
3)The declaration of the function should be as follows:
bool sinFit(const int numPairs, const double xData[], const double yData[], double &a, double &b, double &c, double &d, double &fit)
where:
numPairs: The number of xy pairs provided
xData: Array of X values
yData: Array of Y values
a, b, c, d: are calculated values represented in the equation y = [login to view URL](bx+c)+d
fit: A calculated correlation coefficient (or some other quality of fit if a correlation coefficient is inappropriate)
The function should return true on success and false if an error occurs eg not enough pairs provided
4)The level of accuracy of the fit should be able to be changed either through an additional argument or by setting a variable within the function.
5) It is envisaged that a numerical technique such as a Gaussian fit will be used. We have no preference but a detailed description of the algorithm used must be supplied.
6)The resulting code should be documented with appropriate comments which make its design, purpose and implementation of the chosen algorithm clear to the reader.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) An example program which will demonstrate the use and accuracy of the function.
3) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Windows 98 and later
PLEASE SUBMIT PAST SIMILAR C++ PROGRAM IN ORDER TO BE CONSIDERED FOR THIS PROJECT. THANKS
I'm paying $100 for this job. Higher bidders keep off.