On Sun, 21 Jan 2007, Lynette wrote:
Dear all,
I am using Rdqags in C to realize the integration. It seems for the
continous C function I can get correct results. However, for step functions,
the results are not correct. For example, the following one, when integrated
from 0 to 1 gives 1
Well,
I have no idea either. I can get correct answers for continous functions but
incorrect for step functions.
Sign, I have been trying to realize the integration in C for long time.
Thank you for your answering.
Best,
Lynette
- Original Message -
From: Thomas Lumley [EMAIL
Dear all, especially to Thomas,
I have figured out the problem. For the step function, something wrong with
my C codes. I should use the expression ((x=0.25)(x=0.75)) ? 2:1 instead
of ((x=1/4)(x=3/4)) ? 2:1 ). Have no idea why 0.25 makes difference from
1/4 in C. But now I can go ahead with
On Mon, 22 Jan 2007, Lynette wrote:
Dear all, especially to Thomas,
I have figured out the problem. For the step function, something wrong with
my C codes. I should use the expression ((x=0.25)(x=0.75)) ? 2:1 instead
of ((x=1/4)(x=3/4)) ? 2:1 ). Have no idea why 0.25 makes difference from
Dear all,
I am using Rdqags in C to realize the integration. It seems for the
continous C function I can get correct results. However, for step functions,
the results are not correct. For example, the following one, when integrated
from 0 to 1 gives 1 instead of the correct 1.5
void func(
Hi, Lynette,
A few pointers:
1. Not an R question.
2. Not an ESS question.
3. No reproducible example.
4. (x = 1/4) is comparing a pointer. Surely, this is not what you
intended to do. Plus, if you're using void* then this is not even a C
function called by R. And I'm not familiar with Rdqags.