I Structure of Earth, pressure and density model

I created interpolative curvefits to the graph of Earth's density as a function of radius, shown here:

(Image from Wikipedia)

Earth is assumed to be a sphere of radius 6371 kilometers. The independent variable r is the geocentric distance as a fraction of the Earth's radius; i.e. the range of r is [0,1]. The dependent variable p is Earth's density in kilograms per cubic meter.

From these curvefits, the integrated mass of Earth is 5.9953e+24 kilograms, which is in excess of the experimentally measured value by 0.36%. The calculated surface gravity is 9.8579 m/sec², and the calculated average density is 5534.8 kg/m³. The relative errors are less than 1% in each case, so the equations appear to be returning a very good fit to the PREM density profile, ρ(r), of Earth's interior.

The absolute maximum for gravitational acceleration inside Earth, g(r), occurs at r=0.5470 Re (at the core-mantle boundary), enclosing 0.3259 Me, resulting in g=10.699 m/sec². There is also a local maximum for g(r) at r=0.8950 Re, enclosing 0.8179 Me, resulting in g=10.029 m/sec².