** You can see my full program here. Go ahead and plug it into your notebook. You should have everything you need there. Password: OrbitCode

I am working with the following NDSolve.

allOrbits = NDSolve[equationsForNDSolve, allVars, {t, 0, 25 T}]


equationsForNDSolve = (x[1]^\[Prime]\[Prime])[t] == -((1.32629*10^20 x[1][t])/(x[1][t]^2 + y[1][t]^2)^(3/2)) - (3.30626*10^16 (-x[1][t] + x[2][t]))/((-x[1][t] + ... MANY MORE TERMS ...

allVars = {x[1][t], x[2][t], x[3][t], x[4][t], x[5][t], y[1][t], y[2][t], y[3][t], y[4][t], y[5][t]}

T = (2 a^(3/2) (me + ms) \[Pi])/(Sqrt[G] ms^(3/2));

(Basically, I'm trying to solve a system of equations with many terms per equation. I also have initial conditions.)

I then feed my allOrbits variable into a ParametricPlot function

ParametricPlot[drawList /. allOrbits, {t, 0, T}, AspectRatio -> 1/GoldenRatio, ImageSize -> Large];

You can see the full program here. Password: OrbitCode

The following much shorter code reproduces my results.

NDSolve[{(x^\[Prime]\[Prime])[t] == 1, x[0] == 1, x'[0] == 1}, x, {t, 0, 1}] (Thanks @xzczd!)


Now that you know what I'm doing, here's my question. I haven't run this program in 5 years. When I originally wrote this (admittedly somewhat messy) program, I was on Mathematica When I came back to run it just now on 12.0, I found that a serious bug had emerged. I found that my NDSolve wasn't evaluating in the program. Instead, it was just returning a copy of itself.

When I originally wrote the program, the NDSolve would return a set of associations connecting the functions and InterpolatingFunctions. I need NDSolve to return these associations in order for my program to work properly. As you can see, I use a /.. My expected InterpolatingFunctions look something like this...

Image of InterpolatingFunctions

Now, something has gone wrong such that it just returns this... (please ignore the pink characters in the image below—that is a quirk of the way I have formatted everything)

NDSolve returns itself

(+ many more terms)

And strangely, it's only when I move my cursor to the end of this output, and hit Shift + Enter does it finally evaluate, and I get the output I've been looking for all along.

The output I'm looking for

Shouldn't it evaluate from the get-go? Looking forward to seeing any ideas you might have! Please let me know if I can make myself any more clear.

** Again, you can see the full program here. Password: OrbitCode Go ahead and copy and paste it into your own notebook, and see what happens!

  • $\begingroup$ "Now that you know what I'm doing" No, unless you tell me: do you have a notebook created in v10.3 at hand, or you've copied the code in pastebin into a new Mathematica notebook without any further operation? $\endgroup$
    – xzczd
    Dec 3, 2022 at 6:20
  • 2
    $\begingroup$ In other words, does the following sample reproduce your problem?: NDSolve[{(x^\[Prime]\[Prime])[t] == 1, x[0] == 1, x'[0] == 1}, x, {t, 0, 1}] $\endgroup$
    – xzczd
    Dec 3, 2022 at 6:35
  • $\begingroup$ Hey @xzczd! Yes it that code snippet above does reproduce my problem. Thank you for your help on this. Is there a way to get it to evaluate to the association and InterpolatingFunctions immediately without having to re-evaluate the output separately? PS: Not sure I understand your question about the pastebin; I tried to give you the whole notebook so you could play around with it yourself. $\endgroup$ Dec 3, 2022 at 17:15

1 Answer 1


Short Answer

Transforming your code (to be precise, ^\[Prime]\[Prime] in your code) to the 2D StandardForm will fix the problem. The code can be converted to StandardForm by pressing Ctrl+Shift+n, or select the code and right-click and select Convert ToStandardForm.

Long Answer

The issue actually raise up frequently in this site, but this seems to be the first time it's explicitly asked as a separate question. (Usually it accompanies with other more serious problem and the answerers won't talk much about it. ) So let me elaborate a bit.

This issue will show up if:

  1. You have a code sample (not necessarily a NDSolve[…]) involving StandardForm of Derivative whose differential order is larger than 1.

  2. You copy this code sample from a Mathematica notebook and paste it into somewhere that's not a Mathematica notebook. (Usually a text file, or a Q&A site like here. )

  3. You copy the code sample from that somewhere and again paste it into a Mathematica notebook without any further operation.

Here's a GIF illustrating the whole process:

enter image description here

Why does this happen? It's because:

  1. The StandardForm of high order Derivative will become the combination of ^ and \[Prime] when it's not pasted into a notebook.

  2. 1D …^\[Prime] will not be parsed as a Derivative[…][…] by Mathematica.

Well, personally I think this is a design miss. Perhaps WRI didn't expect there would be a high demand on storing code outside of a notebook. Anyway, it's easy to fix, just convert the code to the 2D StandardForm when you paste it back to notebook, or convert it to 1D InputForm by pressing Ctrl+Shift+i before copying it from a notebook.

"But converting the code will break my typesetting, I don't like it! " Then you may consider using the code here. (You can save it in your SystemOpen@"init.m" file. )

  • $\begingroup$ Thank you! I ended up having to convert basically everything that this function depended on to StandardForm, not just the cell where NDSolve itself appeared. Thanks so much for your help, @xzczd! $\endgroup$ Dec 4, 2022 at 5:22
  • 1
    $\begingroup$ The key point is to convert the ^\[Prime], so in your case you need to convert the definition of equationsForNDSolve. It's not a bad idea to convert everything if typesetting isn't important for you and you don't bother to spot the broken part, of course. @jack $\endgroup$
    – xzczd
    Dec 4, 2022 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.