[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] QAWS & conditional IF / ELSE definition in integrand func
From: |
jeremy theler |
Subject: |
Re: [Help-gsl] QAWS & conditional IF / ELSE definition in integrand function |
Date: |
Thu, 18 Jul 2013 21:01:03 -0300 |
User-agent: |
KMail/1.13.7 (Linux/3.9-1-amd64; KDE/4.8.4; x86_64; ; ) |
yes, although it would be a good idea to avoid generating NaNs by evaluating f
after checking the sign of x (and also the sign of the product alpha*x)
On Wednesday 17 July 2013 14:02:45 Mátyás Benke wrote:
> Hi guys,
>
> I have a quick question regarding the QAWS algorithm.
> Does QAWS allow you to define the integrand function using IF / ELSE
> conditions. For example, will it work in the following way?
>
> double f (double x, void * params)
> {
> double alpha = *(double *) params;
> double f = log(alpha*x) / sqrt(x);
> if (x > 0.0)
> return f;
> else
> return 0.0;
> }Cheers, Matyas