Theoretical Modeling Of The Magnetic And Gravitational Fields Of An Arbitrarily Shaped Three–Dimensional Body