public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Testing exemple in chap.33 problems
@ 2001-12-19 13:20 Robin Drolet
  2001-12-19 13:20 ` Brian Gough
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Drolet @ 2001-12-19 13:20 UTC (permalink / raw)
  To: gsl-discuss

I'm currently testing the non-linear fitting in chapter 33,

I slightly modified the exemple it to accept two guessing parameters instead 
of 3, and the formula X(t)=X(0)exp(-t/Y)

With 10 values of X(t) and t.
t= 10 20 40 80 150 250 400 600 1000 1500
The X(t) values are obtained by placing x(0)=5 and Y=500 in formula to get 
perfect
data. The I place them in the program trying to find back the 5 and 500.

(sigma is calculated for each dot)

Convergence to my values cannot be obtained.

May it be the esprel and espabs (absolute err and relative err, in 
convergence.c) who cause that or is there a problem with ratio testing in 
lmiterate.c or any other
problem I might not have see.

There are no modifications exept those I mantionned, gsl-0.8 no mods in 
source lib.

Thanks
Robin Drolet
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing exemple in chap.33 problems
  2001-12-19 13:20 Testing exemple in chap.33 problems Robin Drolet
@ 2001-12-19 13:20 ` Brian Gough
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Gough @ 2001-12-19 13:20 UTC (permalink / raw)
  To: Robin Drolet; +Cc: gsl-discuss

Robin Drolet writes:
 > I'm currently testing the non-linear fitting in chapter 33,
 >  I slightly modified the exemple it to accept two guessing
 > parameters instead of 3.

Can you send the program, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing exemple in chap.33 problems
       [not found] <F123IeSNLdcIlBUDrM50000cd26@hotmail.com>
@ 2001-12-19 13:20 ` Brian Gough
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Gough @ 2001-12-19 13:20 UTC (permalink / raw)
  To: Robin Drolet; +Cc: gsl-discuss

Thanks for sending the program... the problem is in your decay_f and
decay_df functions.  In the loops of those functions you need to
replace *relaxT by relaxT[i], otherwise the value does not depend on
the index i.  The same applies to *sigma which should be sigma[i] in
both loops.

The iteration will then converge to the expected values.

regards
Brian Gough

diff testbestfit.c.orig  testbestfit.c 
61c61
<               double ITcalc  = I0 *  exp( -( * relaxT / T1or2) );
---
>               double ITcalc  = I0 *  exp( -(relaxT[i] / T1or2) );
87,89c87,89
<               gsl_matrix_set(df,i,0,-1 * exp(-(*relaxT / T1or2))/ (*sigma));
<               gsl_matrix_set(df,i,1,(-I0 * (*relaxT) * exp( -( *relaxT / T1or2))) / 
< (T1or2 * T1or2 * ( *sigma)) );
---
>               gsl_matrix_set(df,i,0,-1 * exp(-(relaxT[i] / T1or2))/ s);
>               gsl_matrix_set(df,i,1,(-I0 * (relaxT[i]) * exp( -( relaxT[i] / T1or2))) / 
> (T1or2 * T1or2 * s));



bjg|debian> ./a.out 
1.000000e-06 p.cent err abs 
1.000000e-06 p.cent err rel
Entrez la valeure de debut pour I(0):1

Entrez la valeure de debut pour T1 ou T2:1
.....
iter:   0 x = 1.000000e+00 1.000000e+00 |f(x)| = 6.324549e+01
status = success
iter:   1 x = 8.114600e+00 1.711493e+00 |f(x)| = 6.321516e+01
status = success
iter:   2 x = 8.336935e+00 1.719542e+00 |f(x)| = 6.321346e+01
status = success
iter:   3 x = 8.769411e+00 1.734927e+00 |f(x)| = 6.321001e+01
....
iter:  29 x = 5.000001e+00 4.999998e+02 |f(x)| = 1.204685e-05
status = success
iter:  30 x = 5.000001e+00 4.999998e+02 |f(x)| = 1.146876e-05
1.086107e-02
-5.692674e-01
-5.692674e-01
7.027986e+01
I0 = 5.000001e+00 +/- 1.042165e-01
T1 or T2 = 4.999998e+02 +/- 8.383308e+00
Status = success

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-12-19 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-19 13:20 Testing exemple in chap.33 problems Robin Drolet
2001-12-19 13:20 ` Brian Gough
     [not found] <F123IeSNLdcIlBUDrM50000cd26@hotmail.com>
2001-12-19 13:20 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).