Gravity inside a star? Recently, I answered this question and need some clarification regarding the gravity when within the radius of a star. I thought that, when something is inside a star (ignoring drag), it will experience less gravity because as it goes deeper inside, more and more mass is outside (in the up direction) the distance left before it reaches the center. Is this true, and is there a formula that needs certain parameters to calculate it?
If you consider a radially symmetric mass distribution, the gravity experienced at a distance $R$ from the center is caused by the mass inside the sphere with radius $R$, thus the mass $$M(R) = \int_0^R \varrho(r)  4 \pi r^2 dr$$ In a radial-symmetric case one can show that the contribution of all masses outside $R$ cancel each other.
Thus the experienced gravitational acceleration at radius $R$ is
$$g(R) = \frac{G}{R^2}\int_0^R \varrho(r) 4\pi r^2 dr$$
The interesting part here is to know the radial density variation $\varrho(r)$ inside your body, thus the Sun in this case. This depends on the equation of state of the matter - which in turn is one of the least well known equations. Deriving that requires intricate modelling of the Sun. There are at least two nice answers which give the radial density variation. There's a link in the first answer to data for the standard solar model for radius, density, enclosed mass etc.
EDIT to add a way to address the density profile:
One may try to get a handle on the density by assuming a polytropic model for the star, such that the relation between pressure $p$ and density $\varrho$ reads like
$$ p = K \varrho^\frac{n+1}{n}$$
With a constant $k$ and the polytrop index $n$. This is a result of the solutions of the Lane-Emden equation
$$\frac{1}{\xi^2} \frac{\mathrm{d}}{\mathrm{d}\xi} \left(\xi^2\frac{\mathrm{d}\theta}{\mathrm{d}\xi}\right) + \theta^n = 0$$which is a dimensionless form of the Poisson equation for a radially-symmetric self-gravitating polytropic fluid, thus where density follows a function of the form $\varrho = \varrho_c \theta^n$ with a central density $\varrho_c$. This equation can be solved exactly for polytrop index 0 (isobaric polytrope), 1 (isothermal polytrope) and 5 (limited use as it results in infinite stellar radius) and can be addressed analytically via convergent series and can also be solved numerically for a wide range of cases.
Yet a main sequence star is believed to be around $n=3$ for the radiation zone. Fully convective stars follow more an adiabatic gradient with n = 5/3 being the ratio of the heat capacity at constant pressure and heat capacity at constant volume for an ideal mono-atomic gas. You will have to integrate the euqation numerically for these cases, though.
(Reinhard Meinel gives excellent lectures on relativistic astrophysics - and I still use my notes from back then as reference - but I'm sadly not aware of any published form of the notes on this particular topic... maybe this)