Let's say we have a planet-sized sphere of some uniform material floating isolated in space, not rotating, with the only significant gravity acting on it coming from its own mass. How would the density vary with depth? Would it be linear, quadratic, cubic, or something else?
For example, say the sphere is composed of iron, with a density at the surface of 7874 kg/m$^3$, and a total mass equivalent to the Earth at 5.972 × 10$^{24}$ kg. How dense would it be, say, at the core, or halfway between the core and the surface? If density were constant such a sphere would have a radius of approximately 5657 km, instead of Earth's own 6357-6371, but due to gravity we would expect the outer mass of the sphere to contract and compress the inner material. I want to know how this gravitational compression affects the density.