Skip to main content
edited tags
Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489
added 163 characters in body
Source Link

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!)

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!)

Source Link

NDSolve doesn't evaluate unless I re-evaluate the output manually

Background

** 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}]

Where

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

Question

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 10.3.1.0. 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!