From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4335 invoked by alias); 12 Jul 2002 20:24:18 -0000 Mailing-List: contact gsl-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sources.redhat.com Received: (qmail 4313 invoked from network); 12 Jul 2002 20:24:14 -0000 Received: from unknown (HELO tlb.blackwells.net) (206.111.132.170) by sources.redhat.com with SMTP; 12 Jul 2002 20:24:14 -0000 Received: from tlb.blackwells.net (localhost [127.0.0.1]) by tlb.blackwells.net (8.12.3/8.12.3) with ESMTP id g6CKODl4055949 for ; Fri, 12 Jul 2002 13:24:13 -0700 (PDT) (envelope-from tlb@tlb.blackwells.net) Message-Id: <200207122024.g6CKODl4055949@tlb.blackwells.net> From: tlb@tlb.org To: gsl-discuss@sources.redhat.com Subject: multifit_nlin on linear data Date: Fri, 12 Jul 2002 13:24:00 -0000 X-SW-Source: 2002-q3/txt/msg00053.txt.bz2 I have a multiparameter fitting problem which is nonlinear in general, but has linear behavior in some regions where I can exactly calculate the derivatives. So sometimes when I use gsl_multifit_fdfsolver it's able to jump to the correct solution in a single jump, as you'd expect it to. But, when this happens, the second iteration of gsl_multifit_fdfsolver_iterate returns GSL_ETOLF, because after the first step it can neither predict nor achieve any further reduction. To paraphrase the code in gtl/multifit/lmiterate.c prered is predicted reduction from step*jacobians [0] actred is result of taking that step [also 0] if (prered > 0) ratio = actred / prered; else ratio = 0; ... if (ratio >= 0.0001) { ... update answer ... else if (fabs(actred) <= GSL_DBL_EPSILON && prered <= GSL_DBL_EPSILON && p5 * ratio <= 1.0) { return GSL_ETOLF; Does this need rethinking, or does my problem need re-posing? My function has regions of linearity and nonlinearity and it's hard for me to know in advance if it's going to admit a single-step solution or not, so it's not easy to just switch to a linear multifit algorithm instead. Should I be using a different termination critereon than gsl_multifit_test_delta? One workaround is to set the elements of the Jacobian matrix to 0.99 * the actual derivative; it then converges nicely in 2-3 steps. Or, I could just accept ETOLF as an indication of being done. -- Trevor Blackwell tlb@tlb.org (650) 776-7870