# Cannot post my question because of code formatting [closed]

I tried to post a question on the Mathematica forum, I spend a hour writting it correctly and I have the following error when I want to submit it : "Your post appears to contain code that is not properly formatted as code."

This is my post :

Hello.

I have a set of coupled Ordinary Differential Equations of the form :

$$N'(r)=\mathcal{D}N(r,N,Y,U,P), \\ Y'(r)=\mathcal{D}Y(r,N,Y,U,P), \\ U'(r)=\mathcal{D}U(r,N,Y,U,P), \\ P'(r)=\mathcal{D}P(r,N,Y,U,P),$$


and I would like to solve it numerically with the numerical solver of Mathematica. The explicit forms of these equations are not very instructive here because they are complicated (for your information, it is the field equations of a modified theory of gravity with spherical symmetry).

For my purpose here, I have an initial condition at a large radius and I want to integrate backward in $r$ until $R=1.0$. Therefore, after defining my equations and my conditions, I use the following instruction

    sm = NDSolve[{eqn, eqY, eqU, eqp, n[rmax] == nmax, Y[rmax] == Ymax,U[rmax] == Umax,p[rmax]==0.0}, {n, Y, U, p}, {r, 1.0, rmax},AccuracyGoal -> 20, PrecisionGoal -> 10] // Flatten


The integration seems successful since I have the following output without any errors

![Output of NDSolve without any errors][1]

But then, when I want to plot the solution (for example the function $N(r)$) with the command :

    plotm = Plot[Evaluate[n[r] /. sm], {r, 1.0, rmax},PlotTheme -> "Scientific", ImageSize -> Large]


there is nothing under $r\approx 5$ even though the integration domain is $[1.0,r_{\text{max}}]$. See on this picture what I get

![Plot][2]

I have the same problem by plotting $Y(r)$ or $U(r)$ (but their plots stop at different radius). It looks like the integrator failed to reach $R=1$ but usually, it prints an error message in this case.

Even more weird, if I ask directly for the numerical value of $N(r)$, it seems to work perfectly. For example, with the instruction

    For[i = 0, i <= 100, i++, Block[{r}, r = 1 + 49.0/100 i; Print[r, "\t", n[r] /. sm]]]


I get the following result

![Numerical values][3]

I have tried to change the vertical axis range on the plot : it changes nothing. The plot stops below some value of $r$ greater than 1.

I am not on expert with these features of Mathematica so may be I have forgotten something obvious but actually I do not see what it is.

Any idea ?

Thank you !

I lost an other hour trying to find the problem, looking for answers on this forum but I still can't fix it...

I used the Ctrl+K shortcut to ident my code.

Any idea ?

• @πάνταῥεῖ I see, thanks. Romain, see this line "AccuracyGoal -> 20, PrecisionGoal -> 10] // Flatten" it is not formatted – Mark Kirby Mar 25 at 17:38
• It was formatted but @πάνταῥεῖ editted my post and make this line out of the identation wrong... – Romain Gervalle Mar 25 at 17:40
• You formatted all the text as code and he fixed it. Is the previous version how it was when you posted it? – Mark Kirby Mar 25 at 17:41
• @RomainGervalle Feel free to edit your question again. But please leave plain text formatted as cite in the text and not as code. – πάντα ῥεῖ Mar 25 at 17:43
• All those bits with the $would need to be formatted too, you can wrap them in  to format in the middle of a sentence. Like this $Y(r)$ – Mark Kirby Mar 25 at 17:46 • @πάνταῥεῖ Yes sorry for this mistake, I fixed it. But I still can't find what is my problem... – Romain Gervalle Mar 25 at 17:47 • @RomainGervalle Are the image links really formatted as code in the question? – πάντα ῥεῖ Mar 25 at 17:48 • @πάνταῥεῖ The Mathematica forum exists : mathematica.stackexchange.com – Romain Gervalle Mar 25 at 17:49 • @RomainGervalle Oh sorry, I didn't know about SE Mathematica. The question should go to SE Meta Mathematica though. And don't call any SE Q&A site a forum please, that's a big annoyance and misunderstanding. – πάντα ῥεῖ Mar 25 at 17:50 • No, the image links are not formatted as code, it is again a mistake of editing... – Romain Gervalle Mar 25 at 17:51 • Try posting it again without the original code formatting, the version after it was edited by @πάντα ῥεῖ it looks fine from where I am. But remove the blockquote formatting, that grey sidebar. – Mari-Lou A Mar 25 at 17:52 • @MarkKirby I though that$ can be used to put inline LaTeX text, isn't it ? – Romain Gervalle Mar 25 at 17:52
• Oh, yes you are right, I got confused because it is not supported here, so does not render the LaTeX, ignore that suggestion. – Mark Kirby Mar 25 at 17:56
• @πάνταῥεῖ There is a Meta Mathematica SE ? Sorry for the use the word forum. – Romain Gervalle Mar 25 at 18:02
• What you wrote is invalid LaTeX/MathJax syntax. You cannot use \\  in plain $$...$$ to get newlines. If you want to format several equations in a single command, you may use for example \begin{align} a&=b\\ c&=d\\ e&=f \end{align}. (This is how it is written in MathJax; in actual LaTeX, this would come without the $$`s.) – Emil Jeřábek Mar 26 at 10:15 ## 1 Answer Ok, I finally found the problem and it seems to be a bug with LaTeX formatting. I post here the solution to help further SE users. The multiline LaTeX formatting (with$$ symbol) does not work at all for the moment even if you follow the good syntax (https://mathematica.stackexchange.com/editing-help).

It is very weird because in the preview, multiline LaTeX appears correctly.