1
$\begingroup$

I am not a mathematician but a simple programmer and came across a situation where I have to calculate different kinds of object volume. There is no specific type of object and i found that there are dozen of formulas to calculate volume like

  1. Cube $= a^3$
  2. Rectangular prism $= a b c$
  3. Irregular prism $= b h$
  4. Cylinder $= b h = π r^2 h$
  5. Pyramid $= \dfrac13 b h$
  6. Cone $= \dfrac13 b h = \dfrac13 π r^2 h$
  7. Sphere $= \dfrac43 π r^3$
  8. Ellipsoid $= \dfrac43 π r_1 r_2 r_3$

and maybe many more. But is there any general formula exists that can calculate the volume of any type of object?

$\endgroup$
  • $\begingroup$ There do exist a general formula, i.e. $V=\iiint_D\,\mathrm dx\mathrm dy\mathrm dz$, but… $\endgroup$ – Saad Nov 23 '18 at 5:01
  • $\begingroup$ @user302797 another horrible formula but ...? $\endgroup$ – Muhammad Faizan Khan Nov 23 '18 at 5:07
  • $\begingroup$ … but of no practical use if one wants to get a value from it, unless using Monte-Carlo. $\endgroup$ – Saad Nov 23 '18 at 5:12
  • $\begingroup$ It depends on how the object is specified, of course. As a programmer, you surely understand that one cannot write a program if one does not know what data structure the input is in! That said, if the shape is given as a polyhedron, you can use a certain sum over the faces. $\endgroup$ – Rahul Nov 23 '18 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.