public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Brian Gough <bjg@network-theory.co.uk>
To: "Robin Drolet" <r_drolet@hotmail.com>
Cc: gsl-discuss@sources.redhat.com
Subject: Re: Testing exemple in chap.33 problems
Date: Wed, 19 Dec 2001 13:20:00 -0000	[thread overview]
Message-ID: <15136.51806.179303.600452@debian> (raw)
In-Reply-To: <F123IeSNLdcIlBUDrM50000cd26@hotmail.com>

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

       reply	other threads:[~2001-12-19 13:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F123IeSNLdcIlBUDrM50000cd26@hotmail.com>
2001-12-19 13:20 ` Brian Gough [this message]
2001-12-19 13:20 Robin Drolet
2001-12-19 13:20 ` Brian Gough

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15136.51806.179303.600452@debian \
    --to=bjg@network-theory.co.uk \
    --cc=gsl-discuss@sources.redhat.com \
    --cc=r_drolet@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).