This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I have solved a differential equation with the gsl successfully and now am attempting to fit the plots back to the function to extract the constants used in solving the DE. As far as I can tell I have done everything to the specs required by the library. But, the numbers I get back are nonsense (except k) and it quits after attempting the first iteration. The code is attached along with the input data. Details follow. The function I have is y = Ar*cos(k*x) - Ai*sin(k*x) + Br*cos(k*x) + Bi*sin(k*x) which would mean that my fitting function is y = (Ar*cos(k*x) - Ai*sin(k*x) + Br*cos(k*x) + Bi*sin(k*x) - y_i)/sigma_i I am triing to solve for Ar, Ai, Br, Bi and k, so my Jacobian would be made up of dy/dAr = cos(k*x)/sigma_i dy/dAi = -sin(k*x)/sigma_i dy/dBr = cos(k*x)/sigma_i dy/dBi = sin(k*x)/sigma_i dy/dk = (-x*Ar*sin(k*x) - x*Ai*cos(k*x) - x*Br*sin(k*x) + x*Bi*cos(k*x))/sigma_i I get the numbers from x_init but with a +/- on the order of 10^34 except for k which comes out fine. I have checked my math multiple times and found no mistakes and I can't find an error in my code although it is obvious that one exists. I have spent alot of time on this and would appreciate any help! -- If you truly love the memory, you must set it free()!
Attachment:
fit.c
Description: Text document
Attachment:
out
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |