# How should the hydrostatic equation be set up for the sun? [closed]

Beforehand I Solved the hydrostatic equilibrium for the sun with constant density. I am then asked with finding the density as a function of the radius, and evaluate what it will do to the differential eq of hydrostatic equilibrium, by constructing it and solving it. (I already solved the equation, with constant density).

Now I created a function for the density in the sun (approximation): \begin{align} \rho(r)&=371.5r^4-1219.8r^3+1475.7r^2-777.3r+150\\ \end{align} and am supposed to derive the hydrostatic equilibrium with that to compare with the result from constant density. Since the function of mass enclosed in r is the only thing I really can change then I believe it's that part that needs to be something different. \begin{align} \frac{dP}{dr}&=\frac{-G·M(r)·\rho(r)}{r^2}\\ \end{align}

As I said the mass function is to change, and I also think need to have equations for energy generations and energy transfer, but how can this be implemented into it?

## closed as off-topic by Yashas, Kyle Kanos, Jon Custer, Rob Jeffries, sammy gerbilDec 20 '17 at 14:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Homework-like questions should ask about a specific physics concept and show some effort to work through the problem. We want our questions to be useful to the broader community, and to future users. See our meta site for more guidance on how to edit your question to make it better" – Yashas, Kyle Kanos, Jon Custer, sammy gerbil
If this question can be reworded to fit the rules in the help center, please edit the question.

• Hi and welcome to the Physics SE! The equations become much more readable and searchable with mathjax. It'd be great if you could use it in your next posts. – stafusa Dec 13 '17 at 8:17
• Your formula for $M(r)$ (the mass inside a radius $r$) is incorrect. – Rob Jeffries Dec 13 '17 at 12:00
• @RobJeffries I just fixed the previous eq, with the polytropic eq. I deleted the polytropic and just used the assumption that the density was constant - so that mass was equal to the volume of a uniform sphere times the density. – Nichlas Madsen Dec 16 '17 at 10:54
• Were you told to use the TOV equation explicitly? To my knowledge, most solar models neglect general relativity; there's simply no point in overcomplicating the numerical calculations for limited returns. A relativistic treatment can be helpful - or necessary - for compact objects like white dwarfs of neutron stars, but probably not for main sequence stars. – HDE 226868 Dec 16 '17 at 21:03

$M(r)$ is the mass inside a radius $r$. $$M(r) = \int 4\pi r^2 \rho(r)\ dr \tag*{(1)}$$
If I then label your other equations as $$\frac{dP}{dr} = - G\frac{M(r)\rho(r)}{r^2} \tag*{(2)}$$ $$\rho(r) = f(r) \tag*{(3)}$$
2. Put that result and equation 3 into equation (2) and then do the integration to obtain $P(r)$.