I have an $(x,y)$ dataset read in from a file. The data do not follow any sort of equation, but have the general shape of $y=x^2$. The data below are a placeholder for my actual data

data = Table[{x,x^2},{x,0,10,0.1}]

I interpolated the dataset:

f = Interpolation[data, InterpolationOrder->2]

I now have an interpolated function f[x] that can be integrated.

How do I perform an integration to find the volume of this interpolated function rotated about the $y$ axis? For example, if my function were actually $y=x^2$, I would convert $x=\sqrt y$ and set the integral up as $\pi\int_a^by\,\mathrm{d}y$ to perform a disk integral about the $y$ axis. How can I do something equivalent using the interpolated function f?


1 Answer 1


You can use InverseFunction.

data = Table[{x, x^2}, {x, 0, 10, 0.1}];
f = Interpolation[data, InterpolationOrder -> 2]

g = InverseFunction[f];
π NIntegrate[g[y]^2, {y, 0, data[[-1, 2]]}]
(* 15708. *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.