Volume is the quantity inside an enclosed 3-dimensional space. It is usually quantified using the SI unit meter cubed and is understood to be the capacity the container can hold whether that be a solid, liquid, gas or plasma.

In math, volume is applied to 3D shapes with straight and/or curved edges.

## Calculating the Volume of a Sphere

A sphere is the three-dimensional version of a two-dimensional circle. In math, a sphere is a collection of points that are all the same distance r from a given point; the point being the centre of the sphere and r the radius.

To calculate the volume of a sphere, use the following math formula:

result = PI * (radius * radius) * height

## Calculating the Volume of a Cone

A cone is a three-dimensional shape that starts from a flat circular base and tapers off to a point.

To calculate the volume of a cone, use the following math formula:

result = 1 / 3 * PI * (radius * radius) * height

## Calculating the Volume of a Cube

A cube is a three-dimensional version of a square. It has six faces, all of equal size.

To calculate the volume of a cube, use the following math formula:

result = length * length * length

## Calculating the Volume of a Cylinder

A cylinder is a three-dimensional shape consisting of two circles at each end and a curved parallel surface joining each circle.

To calculate the volume of a cylinder, use the following math formula:

result = PI * (radius * radius) * height

## Calculating the Volume of a Rectangular Tank

A rectangular tank is the same as a cube but can have sides of different lengths so long as they are perpendicular to their respective adjacent faces.

To calculate the volume of a rectangle tank, use the following math formula:

result = length * length * height

## Calculating the Volume of a Capsule

A capsule is a cylindrical 3D shape with domes at each end.

To calculate the volume of a capsule, use the following math formula:

result = PI * (radius * radius) * height + 4 / 3 * Math.PI * (radius * radius * radius)

## Calculating the Volume of a Spherical Cap

A spherical cap is a portion of a sphere that is sliced along a flat plane.

To calculate the volume of a spherical cap, use the following math formula:

h = ball_radius - Math.sqrt((ball_radius * ball_radius) - base_radius * base_radius) result = 1/3 * PI * (h * h) * (3 * ball_radius - h)

## Calculating the Volume of a Conical Frustum

A conical frustum is a portion of a cone where the top has been sliced off in a flat plane.

To calculate the volume of a conical frustum, use the following math formula:

result = 1/3 * PI * height * ((top_radius * top_radius) + top_radius * bottom_radius + (bottom_radius * bottom_radius))

## Calculating the Volume of an Ellipsoid

An ellipsoid is a sphere with a deformed surface. An example of a natural ellipsoid is planet Earth which is slightly bulged at the equator due to centrifugal forces caused by the Earth's rotation.

To calculate the volume of an ellipsoid, use the following math formula:

result = 4/3 * PI * axis_1 * axis_2 * axis_3

## Calculating the Volume of a Square Pyramid

A square pyramid has a square base with vertical faces meeting at a point.

To calculate the volume of a square pyramid, use the following math formula:

result = 1 / 3 * (edge * edge) * height