# Defining a function by coordinates of points and degree of a polynomial

I'm studying about solid of revolution.

In these studies, I learned that to get the volume of such a solid, I need to know $f(x)$ to describe the contour of the profile. This concept I understood.

$V=\int_a^b \pi f(x)^2 \, dx$

I already know $f(x)$ I can develop what I need:

\begin{align} \displaystyle V=\int^{h}_{0}\pi(\frac{r}{h}x)^2\,dx \\ =\pi\frac{r^2}{h^2}\int^{h}_{0}x^2\,dx \\ =\pi\frac{r^2}{h^2}\frac{x^3}{3}\bigg\vert^h_0 \\ =\frac{1}{3}\pi r^2h \end{align}

f[x_] := r/h x;
Integrate[Pi*f[x]^2, {x, 0, h}]


$\frac{1}{3} \pi h r^2$

$V(r,h)=\frac{1}{3} \pi h r^2$

The above equation is the $V(r,h)$ function for any type of cone.

The question is:

How do I proceed to get $f(x)$?

I made the following attempts...

Fit[{{a, b}, {h, r}}, {1, x}, x]

FindFormula[{{0, 0}, {h, r}}, x]


I want to get $f(x)$ from the following parameters:

1 - Enter a list of points

2 - I want to define the degree of $f(x)$. If the output is of degree $1, 2, ..., n$.

I have already tried Solve,Rsolve, but I believe that these functions do not accept as input some kind of list of points ...

• Perhaps Interpolation is what you are looking for. – MarcoB Jul 14 '17 at 14:24
• I'm not quite clear on what you want. You seem to be asking how to use Mathematica to find the function $f(x)$ for a cone, but you already have that function. Is there a more general case you want to solve? If so, what is it? – Michael Seifert Jul 14 '17 at 14:24
• In the above example I know that $f(x)$ for a cone is $\frac{r}{h}x$. Because I read the theory on another site. But I wanted to get it through some combination of interpolation and some solve ... – Luciano Jul 14 '17 at 15:31