help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] what can I improve in that function ?


From: efavre
Subject: Re: [Help-gsl] what can I improve in that function ?
Date: Thu, 7 Jul 2005 10:23:32 -0300
User-agent: Internet Messaging Program (IMP) 3.2.6

Quoting Emmanuel Favre-Nicolin <address@hidden>:

> Hi,
>
> I have a function  int_PV (see the function at the end of the message) that
> uses gsl_integration_qags routine. There is an error message. I don't know
> what to do with it, what can I do to improve my function or to make
> calculation converging?
>
>
> cacul at values:
> bias =0.001000 mV ; temp_N =0.300000 K ; delta = 0.200000 mV ; Gnn= 1.000000
> ;
> temp_S = 0.300000 K
> gsl: qags.c:543: ERROR: number of iterations was insufficient
> Default GSL error handler invoked.
> Aborted

Is it possible to modify the number of iterations in qags? Do I have to increase
the work space?? Should I modify the integral to make it easier to integrate??
I'm thinking in seeing interval from [epsilon,1]

I also have the "same" integral but on interval [1,+inf] but I already tested on
less problematic integrals that converges when calculated on interval [0,1] but
not on [1,+inf] so I don`t expect improvement on that side.

Last question is qags the best function to calculate the integral int_PV?

>
> double f_PV (double x, void * p) {
>   struct f_params_PV * params = (struct f_params_PV *)p;
>   double bias = (params->bias);
>   double temp = (params->temp);
>   double delta = (params->delta);
>   double temp_S = (params->temp_S);
> return  1/((x*x*x)*sqrt(1-x*x))*( 1/( exp((1/x-bias)/temp)+1 )
> +1/( exp((1/x+bias)/temp)+1 ) -2/( exp((1/x)/temp_S)+1 ) );
>   }
>
>
> double int_PV(double bias, double temp, double delta, double Gnn, double
> temp_S)
> {double result,error;
> struct f_params_PV params_PV;
> gsl_integration_workspace * w = gsl_integration_workspace_alloc (100000);
> gsl_function F;
> //end of declaration
>
params_PV.temp_S=GSL_CONST_MKSA_BOLTZMANN*temp_S/(0.001*GSL_CONST_MKSA_ELECTRON_CHARGE*delta);//TEMP_S
> is in DELTA units now
>
params_PV.temp=GSL_CONST_MKSA_BOLTZMANN*temp/(0.001*GSL_CONST_MKSA_ELECTRON_CHARGE*delta);//TEMP
> is in DELTA units now
> params_PV.delta=delta;
> params_PV.Gnn=Gnn;
> F.function = &f_PV;
> F.params = &params_PV;
> gsl_integration_qags (&F, 0, 1, 0, 1e-7, 100000,w, &result, &error);
> gsl_integration_workspace_free (w);
> //remarque préliminaire a ce niveau du programme on a
> 1/params_PV.temp=0.001*e*delta/(kTn)?
> return result*Gnn*(0.001*delta)*(0.001*delta);
> }
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>


------------------------------------------
This message was sent using CBPF's WebMail 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]