# Numerical integration of samples of a function

I have a function $$c ( I (\vec{r}) )$$. Not a constant, c doesn't denote a constant. So $$c$$ is a function of $$I$$ which is a function of $$\vec{r}$$.

This is hard to sample and I have sampled it for 10,000 values of $$I$$.

I need to integrate $$c$$ across all the space, i.e. a 3Dimensional integral: $$d^3 r$$.

$$\int\int\int c(I(\vec{r})) d^3 r$$

I want to use the already sampled 10,000 $$c$$'s.

Is there a method to numerically integrate my $$c$$ using those samples I already have? The values of $$I$$ at which $$c$$ is sampled are equally spaced in logspace. $$c$$ dies (goes to 0) apart from a very small region in the $$d^3 r$$ space.

I only have $$c(I)$$ and not $$c(\vec{r})$$. I can create a routine which outputs $$I$$ from a vector $$\vec{r}$$ if needed. Again, the sampling of $$c(I)$$ is hard and I cannot sample $$c(\vec{r})$$, i.e. I cannot directly sample $$c$$ from a vector $$\vec{r}$$, but only from a value of $$I$$.

A photo of how c looks like:c versus I

Thank you!

• To clarify: You have $c_i = c(I_i)$ and you know for each $I_i$ what the value of $\vec{r}_i$ was? – user619894 Mar 8 at 13:08
• The $\vec{r}$ never entered into the problem when sampling the $c_i$ values. This sampling was done using a code which takes as input $I$ and outputs $c$. I don't know what the value of $\vec{r}$ was for each of those $I_i$. $\vec{r}$ only comes into play at the integration part. So I don't know what the value of $\vec{r}_i$ was for my sampled $c_i$ values – velenos14 Mar 8 at 13:10
• I have added a photo to show how the c looks like. – velenos14 Mar 8 at 13:17
• So to make this clearer. For some specific values of $\vec{r}$, I have the value of $c$. For other values of $\vec{r}$, I don't have the value of $c$. How can I use only those specific values of $\vec{r}$ I have the $c$ value at to integrate $c$ across the volume space? – velenos14 Mar 8 at 13:26
• What are these "specific" values? the ones for which you have sampled? A subset of them? – user619894 Mar 8 at 13:34