1
00:00:00,250 --> 00:00:06,300
So let's continue, we have just programmed the differential equations, and we have programmed to starting

2
00:00:06,300 --> 00:00:09,780
conditions, and now we can go ahead and solve the problem.

3
00:00:10,590 --> 00:00:17,010
So as always, we will store our solution in the variable and we will call integrate dots.

4
00:00:17,550 --> 00:00:20,700
Solve underscore, I repeat, I think by now, you should know.

5
00:00:21,570 --> 00:00:27,180
And first, we must provide, as always, a function and we must provide some time.

6
00:00:27,210 --> 00:00:31,110
So t start to T and we will to find these in a second.

7
00:00:31,740 --> 00:00:36,210
So t start and T and.

8
00:00:38,510 --> 00:00:44,620
And then we had the final restarting condition, which will be our zero, and this will be our 18 component

9
00:00:44,620 --> 00:00:58,600
factor, and we will use once again the methods are AK 45 and we will output a equidistant array of

10
00:00:58,600 --> 00:01:01,510
time points with the corresponding solutions.

11
00:01:01,960 --> 00:01:11,020
So we will use to out argument, which is optional, and we will create here an array from start to

12
00:01:11,230 --> 00:01:15,730
end with a certain number of steps.

13
00:01:16,390 --> 00:01:19,870
And I think we will use quite a lot of those.

14
00:01:19,900 --> 00:01:25,150
So let's start with 100k and then an extra one so that we have to start point as well.

15
00:01:26,740 --> 00:01:29,320
So the start times easier, just zero.

16
00:01:29,650 --> 00:01:35,680
And then for the end time, we have to think a bit because if we now write 100 here, then this will

17
00:01:35,680 --> 00:01:37,120
be 100 seconds.

18
00:01:37,360 --> 00:01:43,210
And what are 100 seconds in terms of the motion of planets or the Moon?

19
00:01:43,240 --> 00:01:43,840
It's nothing.

20
00:01:44,230 --> 00:01:46,330
So we must use a pretty large number here.

21
00:01:47,110 --> 00:01:57,370
And I want to start you with a year and this is, of course, 60 times 60 times 24 and then times 365.

22
00:01:57,610 --> 00:02:00,880
And if you want to be precise, a quarter seconds.

23
00:02:02,260 --> 00:02:05,200
So this this is a year in astronomical terms.

24
00:02:05,590 --> 00:02:10,740
And so our value will be here like this.

25
00:02:10,750 --> 00:02:19,120
And if we, for example, want to use two years, then we write two times 2.0, OK, and now we can

26
00:02:19,210 --> 00:02:20,320
test if it works.

27
00:02:21,340 --> 00:02:25,510
You see, the simulation was very fast, didn't even take a blink of an eye.

28
00:02:25,600 --> 00:02:27,350
It was finished instantly.

29
00:02:27,360 --> 00:02:31,840
So let's go ahead and see if we can plot something nice here.

30
00:02:32,780 --> 00:02:34,540
So, all right, Paul, dot plot.

31
00:02:35,890 --> 00:02:38,890
And then first of all, I want to plot the trajectory.

32
00:02:39,760 --> 00:02:48,550
So a solution to why zero and solution thought, why one?

33
00:02:48,550 --> 00:02:51,220
So I want to plot the X versus two Y components.

34
00:02:51,940 --> 00:03:00,580
And the first thing that we plot is the trajectory of the Sun and then we go ahead and add to other

35
00:03:00,580 --> 00:03:00,940
plots.

36
00:03:01,870 --> 00:03:03,250
So these will be then the Earth.

37
00:03:04,120 --> 00:03:07,750
So this three and four and we choose a different color here.

38
00:03:07,750 --> 00:03:18,130
Blue and the Moon will be six and seven and the color, for example, green and we see we get a nice

39
00:03:18,130 --> 00:03:18,670
output.

40
00:03:19,600 --> 00:03:21,580
So now let's make the plot a bit nicer.

41
00:03:22,450 --> 00:03:30,670
So let me copy here from my other notebook that I've prepared the aspect ratio that's set one and the

42
00:03:30,670 --> 00:03:34,330
labels, which are X and Y coordinates of the individual objects.

43
00:03:35,590 --> 00:03:38,020
So you see, this is now our output.

44
00:03:39,070 --> 00:03:41,770
And maybe you are wondering now.

45
00:03:42,580 --> 00:03:44,950
So first of all, we see the right trajectory.

46
00:03:44,980 --> 00:03:46,330
That's the motion of the Sun.

47
00:03:46,330 --> 00:03:47,470
And it looks pretty good.

48
00:03:47,500 --> 00:03:50,320
It's just positioned in the center and doesn't move at all.

49
00:03:50,890 --> 00:03:51,960
This is what we want.

50
00:03:51,970 --> 00:03:53,050
This is what we expect.

51
00:03:54,010 --> 00:04:00,580
And then we have the trajectory of the Moon and the Earth.

52
00:04:01,330 --> 00:04:08,350
And it doesn't look so good, to be honest, because they are moving on a spiral shaped trajectory.

53
00:04:09,430 --> 00:04:13,180
And it turns out that the problem is here the accuracy of the solver.

54
00:04:13,660 --> 00:04:17,529
The accuracy is not high enough to get a correct solution here.

55
00:04:18,220 --> 00:04:24,910
And I think this is understandable because all of our units, and especially our time is very, very

56
00:04:24,910 --> 00:04:25,420
large.

57
00:04:25,900 --> 00:04:29,710
So the standard error that is programmed is not sufficient.

58
00:04:30,640 --> 00:04:32,650
So let me show you what the standard error is.

59
00:04:32,890 --> 00:04:36,910
We have a correlative tolerance.

60
00:04:38,140 --> 00:04:40,900
So this is what is acceptable for the solver.

61
00:04:40,930 --> 00:04:47,320
This is 10 to the power of minus three, and we have an absolute tolerance, which will be added.

62
00:04:48,310 --> 00:04:54,450
So you can read if you want to know the details you can read out by just Googling solve on the Scott

63
00:04:54,460 --> 00:04:56,590
IVP, and then these things are explained.

64
00:04:57,040 --> 00:05:00,580
But these are just absolute and relative tolerances for the error.

65
00:05:01,420 --> 00:05:04,930
And this one is, what, 10 to the minus six.

66
00:05:05,320 --> 00:05:08,650
And if I run this now, we get the exact same solution.

67
00:05:08,660 --> 00:05:14,560
So yeah, these are really the standard values, and now we can test what happens if we decrease these

68
00:05:14,560 --> 00:05:15,040
values.

69
00:05:15,790 --> 00:05:24,130
For example, I multiply here by one over a thousand and I multiply here by the same number.

70
00:05:26,950 --> 00:05:30,100
And you see now the spiral, that directory is gone.

71
00:05:31,120 --> 00:05:36,280
And just to be on the safe side, let's just add a few zeros here because you see the calculation was

72
00:05:36,280 --> 00:05:36,640
still.

73
00:05:37,100 --> 00:05:42,530
Every very fast, and I will add here three more zeros and here as well one, two three.

74
00:05:43,310 --> 00:05:49,790
And you see, still the calculation is fast and we have now a nice trajectory.

75
00:05:50,570 --> 00:05:56,300
So now the green object, which is the moon, moves on a circle around the sun.

76
00:05:56,930 --> 00:06:03,530
And actually we have here blue and the green trajectory right on top of each other because the Earth

77
00:06:03,530 --> 00:06:06,920
and the Moon are so close to each other compared to the Sun.

78
00:06:07,910 --> 00:06:12,240
So we can't even see here Ervand individually.

79
00:06:13,040 --> 00:06:20,450
So let's think about how we can basically analyze or discussed this motion in more detail.

80
00:06:20,930 --> 00:06:26,810
And now I will go ahead and analyze the motion of all three objects individually and in more detail.

