Aug 8, 2023 14:49
@ProfRob, I'm having some issues with the equation of state for the polytropic fluid, in a general case. There are some inconsistencies, especially in the relativistic and ultra-relativistic regimes. I'll have to ask a new question about this.
Aug 8, 2023 14:30
Forget what I wrote...
Aug 8, 2023 14:30
Hmm, correction: for a sufficiently low central pressure, the radius isn't infinite.
Aug 8, 2023 14:27
@ProfRob, I remade my numerical integration of the TOV equations for the ultra-relativisitc polytropic fluid (adiabatic index $\gamma = \frac{4}{3}$), and I'm finding something odd: the star appears to have an infinite radius, whatever the central pressure. This is odd with the non-relativistic Newtonian equation which gives an infinite radius only for $\gamma \le \frac{6}{5}$. Do you think this is true?
Aug 6, 2023 01:05
@ProfRob, the pressure at 0.5 is just one example. I can change that value from 0 to 10 (or even more), in the units chosen (for which $G \equiv 1$ and $\kappa \equiv 1$. The shape of the pressure curve is "typical".
Aug 6, 2023 01:05
@ProfRob, how do we know that the infinite radius for $𝑛 > 5$ is also valid for the relativistic regime? The previous argument is from Newtonian's gravity only.
Aug 6, 2023 01:05
About a theoretical proof of infinite radius for $𝑛>5$, I found the following in my notes: For a newtonian polytropic fluid, we can get the potential energy:\begin{equation} π‘ˆ=βˆ’\, \frac{3}{5βˆ’π‘›} \, \frac{𝐺𝑀^2}{𝑅}.\end{equation} So this expression implies $𝑛<5$ to get $π‘ˆ<0$ (gravity is attractive). It gives $π‘ˆ>0$ for all $𝑛>5$, unless $R\rightarrow\infty$. So indeed $\gamma=1+\tfrac{1}{𝑛} = \tfrac{6}{5}=1.20$ is "special". I'm not sure this is also valid for the relativistic (non-newtonian) regime but it makes sense.
Aug 6, 2023 01:05
@ProfRob, I updated my question with two plots for $\gamma = \frac{4}{3}$ (which is larger than your $\gamma = \frac{6}{5} = 1.20$ ($n = 5$). From this plot, I don't see how I could find a finite radius.
Aug 6, 2023 01:05
@Quillo, $\gamma = 5/3$ is certainly larger than 1! I'm not really interested in $\gamma < 1$ and $\gamma > 2$ which are physically very weird (my code shows all sorts of weird singularities with these values). I don't think the cutoff is related in any way to the iron layer. On the contrary, the cutoff is defined at very low pressure and density, which isn't in the core of the star.
Aug 6, 2023 01:05
@Quillo, I'm using all $\gamma$, from $\gamma \approx 1$ up to $\gamma = 2$ (even if non-realistic, to show the effects). Since I'm not using any value of $\kappa$, the output does not depend on the matter type or the micro-physics (except from the $\gamma$). I'll find the radius value in km only if I switch back from unitless variables ($\tilde{p}$ and $\tilde{r}$) to unitfull variables ($p$ and $r$), according to the description below equation (4) (please, read again!).
 

 Discussion between Domen and Cham

Imported from a comment discussion on mathematica.stackexchang...
Jul 29, 2023 23:26
@Domen, yep! This last command appears to solve my issue! Thanks a lot! Case appears to be solved now. Again, thanks for all the help!
Jul 28, 2023 19:28
I just noticed that only 4 spheres cause the warning messages. There's no warning with 3 spheres or less.
Jul 28, 2023 18:45
I can give you the whole code if you wish (I think it's a cool one!). It draws colorfull curbes and balls in 3D, and the manupilation is very nice...
Jul 28, 2023 18:42
6 spheres, sorry, not 8
Jul 28, 2023 18:42
Here's the code input for 8 magnetized sphere, at the beginning of the code: MomMagn = {1, 1, 1, 1, 1, 1}; (*norm of each magnetic moment*)
thetaMu = {45, 45, 0, 90, 180, 60} Pi/
180; (*inclinaison relative to Z axis*)
phiMu = {90, 270, 0, 90, 60, 180} Pi/
180; (*azimutal angle around Z axis*)

source[k_] := {{3, 0, 0}, {-8, 0, 0}, {0, 8, 0}, {0, -4, 0}, {0, 0,
6}, {0, 0, -6}}[[k]] (*position of each magnetic sphere*)
Jul 28, 2023 18:41
Yep, the output is good, but I get several error (warning) messages about precision.
Jul 28, 2023 18:40
I'm just watching if the output is normal...
Jul 28, 2023 18:40
I'll give you the modification to the code (it's simple)
Jul 28, 2023 18:39
Compiling right now with 8 magnetized spheres. I'm getting the error messages
Jul 28, 2023 18:38
Wait a minute...
Jul 28, 2023 18:38
But if I add more sphere, lets see
Jul 28, 2023 18:38
I tried with three spheres, no messages
Jul 28, 2023 18:37
I do use this command on all of my codes. Still getting the error messages. Maybe not related to the conditions, I don't know.
Jul 28, 2023 18:37
I want to solve these error messages. I don't know how.
Jul 28, 2023 18:37
If I use {cond = (r[s, k] > 25 || Apply[Or, Table[r[s, kk] < 1, {kk, 1, Nspheres}]])} inside the With environment, I get exactly the same output (which is nice) as using the StoppingTest line, and still get the error messages: "Event location failed to converge to the requested accuracy or \ precision within 100 iterations between ..."
Jul 28, 2023 18:37
@Domen, then what about the r[s, k] < 1 condition? Why not put it alongside with >25? I don't understand this part
Jul 28, 2023 18:37
Why is the cond event declared inside a With environment, and not the other conditions?
 
Feb 19, 2021 23:14
Sorry, I have to go now. Thanks for the help. But I'm still not convinced that I have the proper solution.
Feb 19, 2021 23:12
I understand, but at least the normal display isn't affected by the text, while it is for the inline equations.
Feb 19, 2021 23:11
In other word: I don't want $y_2(x) = a x^2$ to be affected by the text flowing around it.
Feb 19, 2021 23:10
I mean the same indices and exponents as in a normal display, and the same spacings...
Feb 19, 2021 23:10
Like I said, I don't like the variable output of $y_2(x) = a x^2$, which changes depending of the text around it. I want that equation $y_2(x) = a x^2$ to have the same output whatever the text around it.
Feb 19, 2021 23:09
Two ways?
Feb 19, 2021 23:08
? You mean \everymath{\displaystyle}, plus your solution? There is no other way?
Feb 19, 2021 23:07
But I also need to use $\displaystyle{y_2(x) = a x^2}$ to get proper vertical position of all indices and exponents. I simply need to do all these at the preamble level.
Feb 19, 2021 23:07
Geez this is complicated! For example, I write (inside text) $y_2(x) = a x^2$. The output is frequently variable, depending of the text around it. The spacings may be too strong (dilated, or compressed), because of the text itself. I don't want the text to have an effect here, so I could use ${y_2(x) = a x^2}$, which fixes the spacing.
Feb 19, 2021 23:02
If so, then I would have to use braces (i.e ${...}$) for all my inline math instead?
Feb 19, 2021 23:01
Ahaa ! This is important : does your solution also change the display of any other maths, under the text?
Feb 19, 2021 22:59
Should I put your commands inside the \everymath{\displaystyle} ?
Feb 19, 2021 22:57
Your solution may be the right one I'm looking for. But I was wondering if it was the only one. Especially since I also need to use the \everymath{\displaystyle} command.
Feb 19, 2021 22:55
Yes.
Feb 19, 2021 22:55
I do't understand. Sorry, there may be a communication issue. Currently, I could get the right output if I simply use $\displaystyle{...code in there...}$ for all inline maths. I want to achieve the same by a global preamble command.
Feb 19, 2021 22:53
Again, I just want a global preamble command (or set of commands) to do the same output as using $\displaystyle{...}$ in all local inline equation.
Feb 19, 2021 22:51
Ok. But my question is then the same as my previous comment.
Feb 19, 2021 22:50
Actually, this is my issue: using \everymath{\displaystyle} in the preamble doesn't give the exact same output as $\displaystyle{...}$ for all inline math expressions.
Feb 19, 2021 22:48
By "fixing", I mean to "keep constant". Or if you prefer, to display as in a full math display (below text). Using local ${...}$ fixes my issue, or more specifically $\displaystyle{...}$. I just want to do the same in a global way, in the preamble (in case I change my idea), not in a local way. So what should be a proper preamble command to do the same effect as $\displaystyle{...}$ ? Using only \everymath{\displaystyle} doesn't give the same effect (the spacings aren't the same).
Feb 19, 2021 22:42
For any inline expression, I only type small things (which may have indices and exponents, and small fractions, small relations). All bigger equations are displayed below the text. When I use the normal way, the math horizontal spacings are modified by the text. I need to prevent that to happen.
Feb 19, 2021 22:40
I don't understand greg's answer yet. All I need, is the fix my small inline math expressions as they would appear in a full display (between paragraphs). If I use the normal way with variable inline spacings, and variable position of indices and exponents, the math expressions are frequently very ugly.
Feb 19, 2021 22:34
@DavidCarlisle, ok. But I don't want the text to have any effect on the inline math spacings. I need them to stay the same as if they were displayed between the text paragraphs. The text spacings should be variable in the normal way, but the inline math spacings should stay the same as if they were displayed under the text.
Feb 19, 2021 22:34
@DavidCarlisle, I use displaystyle for inline equations because I want all the indices and exponents to stay the same as in the bigger equations shown between text paragraphs. I also want the horizontal spacing to be the same. I'm only typing small math expressions inline. Never "big" expressions.