So let's continue, we have just programmed the differential equations, and we have programmed to starting
conditions, and now we can go ahead and solve the problem.
So as always, we will store our solution in the variable and we will call integrate dots.
Solve underscore, I repeat, I think by now, you should know.
And first, we must provide, as always, a function and we must provide some time.
So t start to T and we will to find these in a second.
So t start and T and.
And then we had the final restarting condition, which will be our zero, and this will be our 18 component
factor, and we will use once again the methods are AK 45 and we will output a equidistant array of
time points with the corresponding solutions.
So we will use to out argument, which is optional, and we will create here an array from start to
end with a certain number of steps.
And I think we will use quite a lot of those.
So let's start with 100k and then an extra one so that we have to start point as well.
So the start times easier, just zero.
And then for the end time, we have to think a bit because if we now write 100 here, then this will
be 100 seconds.
And what are 100 seconds in terms of the motion of planets or the Moon?
It's nothing.
So we must use a pretty large number here.
And I want to start you with a year and this is, of course, 60 times 60 times 24 and then times 365.
And if you want to be precise, a quarter seconds.
So this this is a year in astronomical terms.
And so our value will be here like this.
And if we, for example, want to use two years, then we write two times 2.0, OK, and now we can
test if it works.
You see, the simulation was very fast, didn't even take a blink of an eye.
It was finished instantly.
So let's go ahead and see if we can plot something nice here.
So, all right, Paul, dot plot.
And then first of all, I want to plot the trajectory.
So a solution to why zero and solution thought, why one?
So I want to plot the X versus two Y components.
And the first thing that we plot is the trajectory of the Sun and then we go ahead and add to other
plots.
So these will be then the Earth.
So this three and four and we choose a different color here.
Blue and the Moon will be six and seven and the color, for example, green and we see we get a nice
output.
So now let's make the plot a bit nicer.
So let me copy here from my other notebook that I've prepared the aspect ratio that's set one and the
labels, which are X and Y coordinates of the individual objects.
So you see, this is now our output.
And maybe you are wondering now.
So first of all, we see the right trajectory.
That's the motion of the Sun.
And it looks pretty good.
It's just positioned in the center and doesn't move at all.
This is what we want.
This is what we expect.
And then we have the trajectory of the Moon and the Earth.
And it doesn't look so good, to be honest, because they are moving on a spiral shaped trajectory.
And it turns out that the problem is here the accuracy of the solver.
The accuracy is not high enough to get a correct solution here.
And I think this is understandable because all of our units, and especially our time is very, very
large.
So the standard error that is programmed is not sufficient.
So let me show you what the standard error is.
We have a correlative tolerance.
So this is what is acceptable for the solver.
This is 10 to the power of minus three, and we have an absolute tolerance, which will be added.
So you can read if you want to know the details you can read out by just Googling solve on the Scott
IVP, and then these things are explained.
But these are just absolute and relative tolerances for the error.
And this one is, what, 10 to the minus six.
And if I run this now, we get the exact same solution.
So yeah, these are really the standard values, and now we can test what happens if we decrease these
values.
For example, I multiply here by one over a thousand and I multiply here by the same number.
And you see now the spiral, that directory is gone.
And just to be on the safe side, let's just add a few zeros here because you see the calculation was
still.
Every very fast, and I will add here three more zeros and here as well one, two three.
And you see, still the calculation is fast and we have now a nice trajectory.
So now the green object, which is the moon, moves on a circle around the sun.
And actually we have here blue and the green trajectory right on top of each other because the Earth
and the Moon are so close to each other compared to the Sun.
So we can't even see here Ervand individually.
So let's think about how we can basically analyze or discussed this motion in more detail.
And now I will go ahead and analyze the motion of all three objects individually and in more detail.