# Gravity inside the earth with non-uniform density [closed]

I want to compute gravity inside the earth in different layers I have their thickness and density, can you please help me which formula I can use for this?

## closed as off-topic by Michael E2, J. M. is away♦Sep 30 '18 at 1:55

• The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm voting to close this question as off-topic because it does not seem to have anything to do with how to use the software Wolfram Mathematica. – Michael E2 Sep 29 '18 at 23:49
• This doesn't seem to be related to Mathematica at all. If you edit your question to explain how you want to use Mathematica for your problem, we can release the hold. – J. M. is away Sep 30 '18 at 1:55

As Isaac Newton showed, you can model the gravitational attraction of a spherically density-symmetric sphere as a point mass at the center. Thus all you need do is calculate the total mass between $$r=0$$ and $$r = r_0$$ (your test point), and then the force is:
$$F = {G\ M(r_0)\ m \over r_0^2}$$
where $$M(r)$$ is the total mass $$0 \leq r \leq r_0$$.
$$M(r_0) = \int\limits_{r = 0}^{r_0} 4 \pi r^2 \rho(r)\ \mathrm dr$$
where $$\rho(r)$$ is the density at radius $$r$$.