Volume of objects

These functions calculate the volume of common objects. Units follow the input: measurements in centimetres produce cubic centimetres. Divide cubic centimetres by 1000 to obtain litres.

volume of objects

The list of volume objects is somewhat shorter than the area list. Remember, you can often use area functions to calculate volume. If it is a hexagone-shaped rod, you can use the are of reg polygon and multiply by the length.

The first out, is a easy one. Volume of a box. Its simply multiply the sides in each direction. Anyway, for the completeness, I have made a function for it.

boxVolume(x; y; z )

Where

Using the following formula:

x ⁣:widthy ⁣:heightz ⁣:depthresult=xyz \begin{aligned} x &\colon\quad \text{width} \\ y &\colon\quad \text{height} \\ z &\colon\quad \text{depth} \\[0.6em] \mathrm{result} &= x\cdot y\cdot z \end{aligned}

Example:

boxVolume(10;15;20)=3000


*The next object is volume of a sphere. *

ballVolume(x )

Where

Using the following formula:

x ⁣:diameterresult=43π(x2)3 \begin{aligned} x &\colon\quad \text{diameter} \\[0.6em] \mathrm{result} &= \frac{4}{3}\cdot \pi\cdot \left(\frac{x}{2}\right)^{3} \end{aligned}

Example:

ball with diameter of 20 cm, what is the volume?

ballVolume(20)=4188.790204 cm3


*The next object is volume of a cylinder: *

cylVolume(x; y )

Where

Using the following formula:

x ⁣:outer diametery ⁣:lengthresult=π(x2)2y \begin{aligned} x &\colon\quad \text{outer diameter} \\ y &\colon\quad \text{length} \\[0.6em] \mathrm{result} &= \pi\cdot \left(\frac{x}{2}\right)^{2}\cdot y \end{aligned}

Example:

A cylinder, 10 cm diameter and 100 cm long:

cylVolume(10;100)=7853.981634


The next object is volume of a cone or truncated cone:

coneVolum(x; y; z )

Where

Using the following formulas:

x ⁣:bottom diametery ⁣:top diameter (=0)z ⁣:heighth=z1yxzresult=13π(x2)2(z+h)13π(y2)2h \begin{aligned} x &\colon\quad \text{bottom diameter} \\ y &\colon\quad \text{top diameter (=0)} \\ z &\colon\quad \text{height} \\[0.6em] h &= \frac{z}{1 - \frac{y}{x}} - z \\ \mathrm{result} &= \frac{1}{3}\cdot \pi\cdot \left(\frac{x}{2}\right)^{2}\cdot \left(z + h\right) - \frac{1}{3}\cdot \pi\cdot \left(\frac{y}{2}\right)^{2}\cdot h \end{aligned}

Here we have the first equation, that determines the height of the missing part in case of a truncated cone,

The next formula calculates the volume of the complete cone and subtracts the missing upper part. If the top diameter is zero, h and the subtracted volume are both zero.

Example:

Truncated cone, 15 cm base diameter, and 10 cm top diameter. The cone is 5 cm tick.

coneVolum(15;10;5)=621.773546 cm3

Another example: lets say, we have a truncated cone like the one above. Then we have a hole trough that is also cone-shaped. the bottom of the hole is 12 cm, and the top is 8 cm. The material is some kind of plastic that have a weight of 2g/cm3. How much is the weight of the whole thing ?

(coneVolum(15;10;5)-coneVolum(12;8;5))*2/1000=0.447677

Also 0,448 Kg.


The next function calculates the volume of a four-sided pyramid:

PyramidVolume(x; y; z )

Where

Using the following formula:

x ⁣:length of one side of basey ⁣:length of second side of basez ⁣:height from center of base to topresult=xyz3 \begin{aligned} x &\colon\quad \text{length of one side of base} \\ y &\colon\quad \text{length of second side of base} \\ z &\colon\quad \text{height from center of base to top} \\[0.6em] \mathrm{result} &= \frac{x\cdot y\cdot z}{3} \end{aligned}

Example:

A pyramid has a 12 × 10 cm base and a height of 20 cm. What is its volume?

PyramidVolume(12;10;20)=800 cm3


The final function in the volume group is the ellipsoid. An ellipsoid resembles a sphere but may have a different diameter along each of its three axes.

elipsoidVolume(x; y; z )

Where

Using the following formula:

x ⁣:diameter x-planey ⁣:diameter y-planez ⁣:diameter z-planeresult=πxyz6 \begin{aligned} x &\colon\quad \text{diameter x-plane} \\ y &\colon\quad \text{diameter y-plane} \\ z &\colon\quad \text{diameter z-plane} \\[0.6em] \mathrm{result} &= \frac{\pi\cdot x\cdot y\cdot z}{6} \end{aligned}

The general ellipsoid formula is 4/3*pi*a*b*c, where a, b, and c are its three semi-axes. Because this function takes diameters, the semi-axes are x/2, y/2, and z/2. Substitution simplifies the result to pi*x*y*z/6, as shown above.

Example:

An ellipsoid measures 10 × 15 × 10 cm. What is its volume?

elipsoidVolume(10;15;10)=785.398163 cm3

This completes the volume functions. Continue with the circumference formulas.