Estimating the Pressure of Earth's Center
The pressure of a medium of density $\rho$ and in a graviational field with strength $g$ at a depth of $z+dz$ is equal to the pressure at $z$ plus the pressure caused by the weight of a slab of volume $A\,dz$, so
\begin{align} P(z+dz)=P(z)+\frac{\rho g A\,dz}{A} \end{align}
The medium at a particular depth is essentially supporting all the material above it. Therefore, the change in pressure of a medium with density $\rho$ and in a gravitational field with acceleration $g$ is equal to \begin{align} \frac{dP}{dz}=\rho g \end{align}
Using <PERSON>'s universal law of gravitation, we have \begin{align} \frac{dP}{dz}=\rho\frac{GM}{(R-z)^2} \end{align} where $R$ is the radius of the Earth. The effective mass contributing to the gravitational field $M$ inside a sphere is equal to the volume of the sphere with radius $R-z$. The volume of a sphere is $\frac{4}{3}\pi R^3$. Therefore, \begin{align} \frac{dP}{dz}&=\rho\frac{G\rho \frac{4}{3}\pi(R-z)^3}{(R-z)^2}\ &=\frac{4}{3}\pi G\rho^2 (R-z) \end{align} Assuming the density is constant, this is a linear first order ordinary differential equation and can be solved by integrating both sides of the equation. 707
\begin{align} P(d)&=\int_{0}^{d}\frac{4}{3}\pi G\rho^2 (R-z)\,dz\ &=\left[-\frac{2}{3}\pi G\rho^2(R-z)^2\right]_{0}^{d}\ &=-\frac{2}{3}\pi G\rho^2(R-d)^2+\frac{2}{3}\pi G\rho^2R^2\ &=\frac{2}{3}\pi G\rho^2(R^2-(R-d)^2) \end{align} Therefore, assuming density is constant, the pressure at the center of the earth is approximately \begin{align} \frac{2}{3}\pi G\rho^2 R^2 \end{align} When all the constants are substituted into the formula however, the value for the pressure is equal to \begin{align} 1.726\times 10^{11}\,\text{Pa}=172.6\,\text{GPa} \end{align} However, this is roughly half the cited value for the pressure at the center of the Earth which is approximately $330\,\text{GPa}$. I've also tried changing the model slightly by not assuming that the density is constant, and that for depths between $0$ and $3000\,\text{km}$, the density is $4.9\times 10^3\,\text{kg}/\text{m}^3$, and for depths between $3000$ and the Earth's center, the density is $11\times 10^3\,\text{kg}/\text{m}^3$. This improves the estimation slightly to around $220\,\text{GPa}$. Still, it's not very close to the currently theorized value. Are there any ways to improve the accuracy of the model, or should another method be used?
Link to image used at attempted improvement of model: Graph of Earth's density vs depth. 402