This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: Nonlinear Least-Squares Fitting Help
- From: Fleur Kelpin <fleur at bio dot vu dot nl>
- To: Reid Nichol <sigma at xander dot safepassage dot ca>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Thu, 13 Jun 2002 02:18:47 +0200 (MEST)
- Subject: Re: Nonlinear Least-Squares Fitting Help
Hi again!
I had a look at your datafile and it seems like the 6th and 7th columns
contain the imaginary part of y.
So compare also the (ai+bi)cos(kx) + (ar-br)sin(kx) to these yi and I
think you will be able to identify both parts of a and b.
Hope this helps,
Fleur
On Wed, 12 Jun 2002, Reid Nichol wrote:
> Fleur, you do have a good point about the paramters.
>
> Here is a better explination of my task.
>
> The DE I solved was
> d^2y/dx^2 - y*omega^2 = 0
> split it into real and imaginary parts yeilds
> d^2y_r/dx^2 - y_r*omega^2 = 0
> d^2y_i/dx^2 - y_i*omega^2 = 0
> which I solved successfully with the GSL
>
> The thing is that the equation that I want to fit the generated plots to is
>
> y = A*e^ikx + B*e^-ikx
> where A, B are complex
> so A = Ar + i*Ai and B = Br + i*Bi
>
> this was converted to
> y = [ (Ar + Br)*cos(k*x) + (Bi - Ai)*sin(k*x) ] + i [ (Ai + Bi)*cos(k*x) + (Ar - Br)*sin(k*x) ]
> y = y_r + i*y_i
>
> The 2nd column from the data file corresponds to y_r so I used that in my fitting function. So when I did what you suggested it did fix some things but I lost the ability to solve for the components of A, B which is what I have been charged to do.
>
> I just finished my first year Physics so please forgive me if I'm giving too much or too little info. I have been looking at the same problem for too long so if you or anyone could suggest a more appropriate course of action that'd be great as I can't think of another one. I do believe that I am being restricted to the GSL though. Not that I mind, it looks like a great library!
>
> --
> If you truly love the memory, you must set it free()!