- #1
Niles
- 1,866
- 0
Hi
I have a data set of the form:
This data set is a probability density function (PDF), and I need to be able to integrate it from 0 to some x<22. I thought that I would use an interpolating function for this. However, there is a "gap" between 4 and 20, where the PDF is zero, but an interpolating function doesn't take that into account by itself (I think). Is there a smarter way of accounting for this other than manually inserting data points?
The second problem is that ListInterpolation only takes a 1D-list. So I can only feed it the 2nd coordinate of the data points. However, I need somehow for the interpolation function to run from 0 to 22. I don't know how to do that.
I appreciate any help and suggestions.
Niles.
I have a data set of the form:
Code:
data = {{0, 0}, {1, 1}, {2, 2}, {3, 20}, {4, 1}, {20, 1}, {21, 1}, {22, 0}};
This data set is a probability density function (PDF), and I need to be able to integrate it from 0 to some x<22. I thought that I would use an interpolating function for this. However, there is a "gap" between 4 and 20, where the PDF is zero, but an interpolating function doesn't take that into account by itself (I think). Is there a smarter way of accounting for this other than manually inserting data points?
The second problem is that ListInterpolation only takes a 1D-list. So I can only feed it the 2nd coordinate of the data points. However, I need somehow for the interpolation function to run from 0 to 22. I don't know how to do that.
I appreciate any help and suggestions.
Niles.