[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Error in integration
From: |
Carsten Fortmann |
Subject: |
Re: [Help-gsl] Error in integration |
Date: |
Thu, 27 Apr 2006 10:02:32 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051013) |
VINU,
consider this:
double fw(double x, void * params=&gAlpha)
{
gsl_error_handler_t * old_handler=gsl_set_error_handler_off();
//switch off default error handler, store old error handler in
//old_handler
gsl_integration_workspace * workspace=
gsl_integration_workspace_alloc(10000);
gsl_function F;
F.function=&A; //double A() is declared elsewhere in the code
F.params=&gAlpha;
double LoLimit=-1.;
double UpLimit=1.;
double relerr=0.01; //initial error tolerance (relative error)
int status=1;
while(status)
{
status=gsl_integration_qag(&F,LoLimit,
UpLimit,0.,relerr,10000,1,workspace,&result1,&error);
relerr*=1.1;
if(status) std::cout<<"Increased tolerance="<<relerr<<"\n";
}
//if integration routine returns error code, integration is repeated
//using increased error tolerance, message is printed out
gsl_set_error_handler(old_handler); //reset error handler (might
be unneccessary.
return result1;
}
VINU V. wrote:
dear sir
I am doing integration using gsl.
But for some parameters in the function to be integrated, i am
getting the
error
"gsl: qags.c:548: ERROR: cannot reach tolerance because of roundoff error
Default GSL error handler invoked.
error: line 4: 2251 Aborted (core dumped) ./a.out"
I have to do the integration for a huge set of parameters. I need to
neglect those parameters and continue the integration for the next set of
parameters.
I don't know how to use the error handler for integration.
Could you please help me?
regards
Vinu Vikram
--
*********************************************
Carsten Fortmann
Inst. f. Physik
Universitaet Rostock
18051 Rostock
Tel: +49-381-498-6943
Fax: +49-381-498-6942
mailto address@hidden
http://www.mpg.uni-rostock.de/mp
*********************************************
--
*********************************************
Carsten Fortmann
Inst. f. Physik
Universitaet Rostock
18051 Rostock
Tel: +49-381-498-6943
Fax: +49-381-498-6942
mailto address@hidden
http://www.mpg.uni-rostock.de/mp
*********************************************