Why my this formula doesn't satisfy the formula of volume of sphere?

106 Views Asked by At

I've defined the function which returns a volume of sphere as a radius value given.

$f(a):=2\int_{0}^{a}\pi*r^{2}*dr$

I thought that above function is correct but actually it is not correct.

The return value of the above function is $\frac{2\pi a^{3}}{3}$

The $2$ at the leftmost of the function represents of a double of volume of hemisphere.

Can anyone tell my why this function is not working?

1

There are 1 best solutions below

2
On BEST ANSWER

Given a radius $r$, consider the graph of the semicircle given by $y = \sqrt{r^2 - x^2}$ for $x \in [-r, r]$. Rotate this graph about the $x$-axis, and you will find the volume of the resulting sphere as an integral.