@article {10.3844/pisp.2025.7.17, article_type = {journal}, title = {A Generalized Algorithm for the Gravitational Potential of a Homogeneous Cuboid}, author = {Periyandy, Thundenran and Bevis, Michael}, volume = {16}, year = {2025}, month = {Nov}, pages = {7-17}, doi = {10.3844/pisp.2025.7.17}, url = {https://thescipub.com/abstract/pisp.2025.7.17}, abstract = {This paper presents a mathematical formulation for computing the gravitational potential of a cuboid (or right rectangular prism) with uniform density. The resulting analytical expressions are valid inside, on and outside the cuboid. The methodology systematically organizes logarithmic and arctangent terms using a hexagonal graph approach, promoting numerical stability and correct sign allocation. We provide a structured pseudocode algorithm to facilitate computational implementation, and actual codes written in Python, Matlab and Julia. We also introduce a test, that we call a Laplacian test, used to validate our algorithm and codes. Keywords: Gravitational Potential, Cuboid, Hexagonal Graph, Finite Differences, Laplacian Test.}, journal = {Physics International}, publisher = {Science Publications} }