1
00:00:00,120 --> 00:00:05,680
So we have just defined our new functions for the higher order differential equation, which is here

2
00:00:05,680 --> 00:00:12,090
of second order and now we will test if this code is correct and we will solve the example of the free

3
00:00:12,090 --> 00:00:12,450
fall.

4
00:00:13,650 --> 00:00:18,450
So I told you already that I considered here a mass for one and then we can write second.

5
00:00:18,450 --> 00:00:20,970
All the derivative of Y is equal to minus G.

6
00:00:21,750 --> 00:00:28,890
And we can, of course, also write this down as f of T and first derivative of Y and Y is equal to

7
00:00:29,070 --> 00:00:29,730
minus G.

8
00:00:30,570 --> 00:00:37,860
So our function F will just be a constant minus D, and it will not actually depend on T first derivative

9
00:00:37,860 --> 00:00:39,540
of Y and also not on Y.

10
00:00:41,160 --> 00:00:43,830
So analytically does is solvable pretty easily.

11
00:00:43,830 --> 00:00:47,520
You just have to integrate twice with respect to time.

12
00:00:48,060 --> 00:00:55,260
So you get minus G half times square and then these v zero times T and y zero terms.

13
00:00:55,980 --> 00:01:02,430
But if we say we don't want to think and we just want to numerically calculate, then previously we

14
00:01:02,430 --> 00:01:03,720
wouldn't have been able so.

15
00:01:03,960 --> 00:01:07,620
But now with our new routine, we can see if we can restore this result.

16
00:01:08,880 --> 00:01:10,320
So I will just right.

17
00:01:11,010 --> 00:01:13,160
First of all, I have to define the function, of course.

18
00:01:13,170 --> 00:01:24,330
So G is equal to nine point eight one, and the function we will define by writing F below is pretty

19
00:01:24,330 --> 00:01:26,670
similar to previously, but we aren't here.

20
00:01:26,670 --> 00:01:30,970
T call my wife, but now we must provide, of course, both of these arguments.

21
00:01:31,890 --> 00:01:35,940
And maybe I should use the same nomenclature as here.

22
00:01:36,120 --> 00:01:42,720
And since we have used the same nomenclature for the functions of first comes the actual value and then

23
00:01:42,720 --> 00:01:43,800
comes the derivative.

24
00:01:44,520 --> 00:01:49,620
So maybe it's better to change this year so that there is no confusion.

25
00:01:51,630 --> 00:02:01,560
And so I start with the actual value and then with the first derivative and the function itself is just

26
00:02:01,560 --> 00:02:02,310
a constant.

27
00:02:02,430 --> 00:02:05,640
But it could also just depend on all of these values.

28
00:02:05,640 --> 00:02:06,330
It would work.

29
00:02:07,320 --> 00:02:09,720
But here we will only have the constant minus g.

30
00:02:11,460 --> 00:02:17,340
Now we will need some starting values, so we will have to provide all of these values here basically.

31
00:02:17,340 --> 00:02:18,960
So let me copy this.

32
00:02:21,750 --> 00:02:23,730
So we have our f who d e already.

33
00:02:24,240 --> 00:02:31,620
And though we need to starting time to zero, which I choose to be zero, we need to starting alternate,

34
00:02:31,620 --> 00:02:34,420
which should be 10 could.

35
00:02:34,950 --> 00:02:39,960
So these are really just arbitrary values that I selected doesn't really matter so much what you choose,

36
00:02:41,280 --> 00:02:45,750
the velocity, which will be the first derivative at the time, zero is 50.

37
00:02:46,410 --> 00:02:56,520
And then we only need and max and h the step size and then we have to store to resolve once again in

38
00:02:56,520 --> 00:02:57,170
the solution.

39
00:02:57,180 --> 00:02:59,370
This is very similar to what we did previously.

40
00:03:00,150 --> 00:03:06,180
And then we need two plots so I can run this and that this doesn't give an error, which is good enough

41
00:03:06,180 --> 00:03:07,200
now I want to plot.

42
00:03:07,710 --> 00:03:12,540
So I will just copy our code from before and modify it.

43
00:03:14,970 --> 00:03:19,050
So here we will compare this to the analytical solution.

44
00:03:19,080 --> 00:03:21,540
So for this, I will the right here.

45
00:03:21,550 --> 00:03:32,970
The analytical solution, which is minus g half times Test T squared plus two, is zero, which is this

46
00:03:33,660 --> 00:03:34,440
times T.

47
00:03:37,260 --> 00:03:50,250
Plus, y0, OK, and here we will plot the coordinates, which I think should be OK as it is.

48
00:03:50,670 --> 00:03:51,210
Let's see.

49
00:03:52,650 --> 00:03:53,670
Yes, looks pretty good.

50
00:03:54,120 --> 00:03:56,590
So we have our typical parabola.

51
00:03:57,090 --> 00:03:59,780
This is, of course, describing here.

52
00:03:59,820 --> 00:04:09,420
A free fall were where we have a starting value of 10 notes already starting value of the afternoon.

53
00:04:09,840 --> 00:04:11,250
So it starts here at 10.

54
00:04:11,310 --> 00:04:11,700
Yes.

55
00:04:12,240 --> 00:04:15,780
And then we have a starting velocity of positive 50.

56
00:04:16,589 --> 00:04:21,220
So in the beginning, it will move 50 units in one seconds.

57
00:04:21,240 --> 00:04:24,940
So at one second it should approximately be at 60.

58
00:04:25,800 --> 00:04:26,790
OK, this works.

59
00:04:27,360 --> 00:04:36,210
And then we have the gravity which pushes the objects down to Earth after some time because the acceleration

60
00:04:36,210 --> 00:04:38,250
is acting along the opposite direction.

61
00:04:38,250 --> 00:04:44,310
And so the velocity will decrease and the rate at which to coordinate increases will slow down.

62
00:04:44,310 --> 00:04:49,960
And at some point it will reach to maximum and then it will be pushed back to Earth.

63
00:04:51,090 --> 00:04:55,410
So to further analyze this, we could also plot here the velocity.

64
00:04:55,950 --> 00:05:02,880
And for this, we just have to access the second or the last list here, which is the Y1 values.

65
00:05:03,660 --> 00:05:04,410
So like this?

66
00:05:05,280 --> 00:05:10,560
And then you see we plot the position and the velocity in the same diagram.

67
00:05:11,340 --> 00:05:18,960
So I write why and we and you see the velocity starts at 50 and it decreases.

68
00:05:19,440 --> 00:05:25,620
And when the coordinate has its maximum here and the velocity is zero because it's the first order derivative

69
00:05:25,620 --> 00:05:30,420
and then the velocity gets negative, which is why the coordinate decreases.

70
00:05:31,740 --> 00:05:38,370
So you see, we really are able to solve also second order differential equations with our new method,

71
00:05:38,790 --> 00:05:45,540
which is based on the Euler method, and we can use it because we have reduced to second or the differential

72
00:05:45,540 --> 00:05:52,080
equation to to first order differential equations where we can solve both of them with the oil method.

