Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,720 --> 00:00:01,540
What is going on?
2
00:00:01,920 --> 00:00:11,520
And in this video, we are going to solve this amazing and kind of long exercise about rational numbers.
3
00:00:11,610 --> 00:00:13,500
OK, so that's what we are going to do.
4
00:00:14,040 --> 00:00:15,680
We are going to write down.
5
00:00:15,690 --> 00:00:23,700
Here are the instructions write down his product called rational, and these drugs should basically
6
00:00:23,700 --> 00:00:27,270
represent a numerator and a denominator.
7
00:00:27,930 --> 00:00:36,560
And these strength should also kind of simulate the operations or basically not the struct itself.
8
00:00:36,570 --> 00:00:44,670
But for this point in time, we will use separate functions that should get and work on various.
9
00:00:46,020 --> 00:00:50,460
Struct regional struct variables, so that's what we are going to do.
10
00:00:50,820 --> 00:00:52,950
And now let us start.
11
00:00:53,250 --> 00:00:53,760
All right.
12
00:00:54,060 --> 00:00:57,670
So I hope, first of all, that you tried to solve this exercise on your own.
13
00:00:57,930 --> 00:01:02,580
It's very important and very crucial to your understanding.
14
00:01:02,940 --> 00:01:03,540
Can you hear me?
15
00:01:04,050 --> 00:01:04,440
Right.
16
00:01:05,160 --> 00:01:10,620
So now after you've tried it on your own, we are going to do that together.
17
00:01:11,250 --> 00:01:14,580
So first of all, we need to create the structure itself.
18
00:01:15,450 --> 00:01:23,550
And the way we do that is simply by writing down the following line typedef struct regional, specifying
19
00:01:23,550 --> 00:01:28,890
the fields of this structure and the fields are going to be is following.
20
00:01:29,010 --> 00:01:34,320
There is the numerator and there is there the numerator denominator.
21
00:01:34,740 --> 00:01:36,180
So it's going to look like this.
22
00:01:36,180 --> 00:01:39,240
Am I going if I'm going to get my awesome pen?
23
00:01:39,630 --> 00:01:44,370
So basically, every rational number is going to look like this.
24
00:01:45,180 --> 00:01:50,940
So this is a rational, rational number.
25
00:01:52,630 --> 00:02:01,960
You're also getting -- much better after my tutorials, so this one here is basically the nominator.
26
00:02:03,380 --> 00:02:04,160
Noumea.
27
00:02:05,120 --> 00:02:07,880
Rita, and this one is.
28
00:02:09,170 --> 00:02:10,250
The denominator.
29
00:02:11,410 --> 00:02:13,390
Then nominator.
30
00:02:14,630 --> 00:02:19,730
OK, so two fields representing irrational number.
31
00:02:20,480 --> 00:02:20,990
Awesome.
32
00:02:22,070 --> 00:02:29,750
So a variable of the irrational number is basically going to have these two fields and they are kind
33
00:02:29,750 --> 00:02:32,390
of representing this structure.
34
00:02:32,990 --> 00:02:34,430
OK, good.
35
00:02:35,000 --> 00:02:37,670
So let's start working with the functions.
36
00:02:38,180 --> 00:02:43,940
And the first function that they asked us to make is the increment function.
37
00:02:44,570 --> 00:02:52,460
So if we want to write down a function that should work on a rational variable and incremented by one
38
00:02:52,850 --> 00:02:57,950
before, first of all, need to understand the process of working with increment.
39
00:02:58,610 --> 00:03:02,810
And the way to do that is simply writing down in increase meant.
40
00:03:03,560 --> 00:03:11,120
So before I write down, the implementation is I already told you write down on a piece of paper the
41
00:03:11,120 --> 00:03:15,530
main steps that you want to follow in order to complete this process.
42
00:03:16,220 --> 00:03:16,550
OK.
43
00:03:16,760 --> 00:03:17,330
You following.
44
00:03:17,960 --> 00:03:18,410
Awesome.
45
00:03:18,980 --> 00:03:22,070
So we want the following operation.
46
00:03:22,070 --> 00:03:27,440
We want to take some rational number and simply adding one to it.
47
00:03:28,010 --> 00:03:30,860
That's the default increment that I'm going to use.
48
00:03:33,290 --> 00:03:40,400
So basically, just before we move on to this increment, this note, I got to say to you explicitly.
49
00:03:40,670 --> 00:03:46,730
So in this case, when we are going to work on these basic, let's call it structure of numerator and
50
00:03:46,730 --> 00:03:47,420
denominator.
51
00:03:47,810 --> 00:03:54,860
Well, for simplicity, we will assume that both the numerator and denominator are greater than zero.
52
00:03:55,130 --> 00:04:00,290
Okay, I'm not going to dive into all the details of what happens if both of them are less than zero,
53
00:04:00,290 --> 00:04:06,020
or if any of them equals to zero, or if any of them is a negative.
54
00:04:06,230 --> 00:04:10,760
So for now, let's assume for simplicity, OK, that both of them are zero.
55
00:04:11,750 --> 00:04:13,220
OK, so write down this note.
56
00:04:14,130 --> 00:04:14,580
Awesome.
57
00:04:15,150 --> 00:04:19,270
So what we need to do now is to understand what is the result?
58
00:04:19,290 --> 00:04:26,280
First of all, on paper of this operation, it's not going to be like if you take one divided by three,
59
00:04:26,640 --> 00:04:29,670
OK, one third and you add one to it.
60
00:04:29,700 --> 00:04:32,580
The result is not two divided by three.
61
00:04:33,120 --> 00:04:33,960
That's not it.
62
00:04:34,680 --> 00:04:38,370
What you do is you do some common ground common denominator.
63
00:04:39,120 --> 00:04:39,630
OK.
64
00:04:40,410 --> 00:04:47,850
So basically, you expand these value to be represented as, for example, the denominator of this is
65
00:04:47,850 --> 00:04:52,140
D, this is an OK and for a numerator and D for the denominator.
66
00:04:52,620 --> 00:05:01,280
So this will look like this and divided by de plus d divided by D right d, divided by d denominator
67
00:05:01,280 --> 00:05:03,360
or divided by denominator is the same number.
68
00:05:04,260 --> 00:05:10,530
We just represent the value of one as a whole, as simply denominator by denominator of this one.
69
00:05:11,100 --> 00:05:20,010
And this will allow us basically now when both of our rational numbers have the same denominator, we
70
00:05:20,010 --> 00:05:24,690
can write the result as numerator plus the denominator.
71
00:05:25,110 --> 00:05:26,490
This will be the result.
72
00:05:26,820 --> 00:05:34,200
So for example, if we come again to this question, OK, we can say that the final result will be what
73
00:05:34,800 --> 00:05:41,310
the denominator, which is three it will be one the numerator plus three.
74
00:05:41,700 --> 00:05:45,330
So the final result should be four divided by three.
75
00:05:46,350 --> 00:05:46,740
OK.
76
00:05:47,820 --> 00:05:52,230
That's the basic way to work with incremental one by one.
77
00:05:53,340 --> 00:05:56,460
So now that you realize what you have to do on paper?
78
00:05:56,490 --> 00:06:03,420
Oh, sorry, I think I have covered this solution, so let me get it like that.
79
00:06:03,630 --> 00:06:05,430
OK, so this is it.
80
00:06:05,640 --> 00:06:09,540
This is this is the solution right here of the incremental incrimination.
81
00:06:09,540 --> 00:06:12,060
So let me write it down a little bit above.
82
00:06:13,430 --> 00:06:13,870
OK.
83
00:06:13,910 --> 00:06:16,140
So, yes, sorry about that.
84
00:06:16,160 --> 00:06:25,740
I was basically covering everything, so increment is basically the result should be like numerator
85
00:06:25,740 --> 00:06:28,610
or divided by denominator of plus one equals.
86
00:06:28,610 --> 00:06:32,880
Two want to end plus rd divided by d k.
87
00:06:32,930 --> 00:06:34,340
Hopefully this is cleared for you.
88
00:06:34,340 --> 00:06:36,620
If not, feel free to ask any questions.
89
00:06:38,000 --> 00:06:39,720
And we gave a couple of examples.
90
00:06:39,740 --> 00:06:47,840
Also, if we give another example, it's say two divided by five plus one will be equal to five.
91
00:06:48,140 --> 00:06:52,610
And we take two two divided by five plus five, divided by five is one.
92
00:06:53,210 --> 00:06:54,770
So that will be the result.
93
00:06:54,770 --> 00:06:55,220
Seven.
94
00:06:55,220 --> 00:06:56,030
Divided by five.
95
00:06:56,240 --> 00:06:56,870
Basic math.
96
00:06:57,080 --> 00:07:00,620
OK, so now let's take a look at the function implementation.
97
00:07:01,430 --> 00:07:04,550
So we are going to uncomment this part.
98
00:07:05,180 --> 00:07:07,610
OK, well, let's also remove this one.
99
00:07:08,150 --> 00:07:09,110
We already know it.
100
00:07:09,890 --> 00:07:10,490
OK, good.
101
00:07:11,210 --> 00:07:11,540
So.
102
00:07:12,570 --> 00:07:13,680
We are going.
103
00:07:14,670 --> 00:07:21,180
To make a function of avoids type because we do not expect this function to return anything, so we
104
00:07:21,180 --> 00:07:23,250
are going to call it regional increment.
105
00:07:23,760 --> 00:07:29,490
It's going to get an address of some existing of some existing
106
00:07:31,890 --> 00:07:33,780
regional variable.
107
00:07:34,560 --> 00:07:42,870
And then we are going to say that the result, no matter enumerator, OK, that the result numerator
108
00:07:42,870 --> 00:07:47,100
will be equal to the numerator itself that we take.
109
00:07:47,280 --> 00:07:48,960
This is this is it?
110
00:07:49,860 --> 00:07:55,080
And also, we are going to add to it its denominator.
111
00:07:55,680 --> 00:08:00,150
OK, so numerator plus denominator, that's what we are going to do.
112
00:08:00,810 --> 00:08:01,920
That's basically what we do.
113
00:08:01,920 --> 00:08:03,540
So let's take another example.
114
00:08:03,570 --> 00:08:06,660
Let's take a look at this example we have here.
115
00:08:06,930 --> 00:08:11,430
First of all, this is our rational object, rational variable.
116
00:08:11,670 --> 00:08:16,080
It has the numerator of two and the denominator of five.
117
00:08:16,830 --> 00:08:23,790
And then we say that the result is going to be the previous numerator plus plus the denominator divided
118
00:08:23,790 --> 00:08:24,660
by denominator.
119
00:08:24,870 --> 00:08:26,070
That's what it's going to be.
120
00:08:27,930 --> 00:08:30,960
So we can say that this function is over.
121
00:08:30,990 --> 00:08:31,590
It's done.
122
00:08:32,130 --> 00:08:38,850
So one question for you is how you can call this function and you can focus this function in very simple
123
00:08:38,850 --> 00:08:39,150
way.
124
00:08:39,570 --> 00:08:41,280
You can simply write down.
125
00:08:41,340 --> 00:08:47,640
Then when you are going to check out in the main function, you can write down, create some rational
126
00:08:47,640 --> 00:08:48,150
number.
127
00:08:48,540 --> 00:08:53,190
So create regional are one with, I don't know, one in three values.
128
00:08:54,930 --> 00:08:55,410
OK.
129
00:08:56,520 --> 00:09:03,120
And then what we are going to do is simply make this function, call this rational increment.
130
00:09:04,240 --> 00:09:07,720
And then specify here the address of our one.
131
00:09:08,410 --> 00:09:10,120
That's what we are going to do.
132
00:09:11,290 --> 00:09:20,950
So now if we take a closer look than what we will see that after this line, what basically has happened
133
00:09:21,340 --> 00:09:26,500
is that we increased this value to be four divided by three.
134
00:09:27,520 --> 00:09:30,250
That's everything about rational increment.
135
00:09:30,730 --> 00:09:31,180
Awesome.
136
00:09:32,350 --> 00:09:35,890
Now if we take a look at the next one, which is decrement.
137
00:09:37,450 --> 00:09:39,190
It's going to be pretty much the same.
138
00:09:40,260 --> 00:09:40,630
OK.
139
00:09:40,650 --> 00:09:43,530
We are simply going to expand it a little bit.
140
00:09:44,250 --> 00:09:50,850
And we are going to say that the numerator equals to the previous numerator minus the denominator.
141
00:09:51,970 --> 00:09:53,290
So he's going to look like this.
142
00:09:54,310 --> 00:10:01,120
It's going to look like this, it's going to look like one divided by or at, let's see, three divided
143
00:10:01,120 --> 00:10:01,840
by five.
144
00:10:02,530 --> 00:10:07,180
Let's give another example of seven divided by four minus one.
145
00:10:07,990 --> 00:10:10,240
It will be equal to seven.
146
00:10:11,440 --> 00:10:16,990
All of the divided by four minus four, and the final result will be three divided by four.
147
00:10:18,180 --> 00:10:18,630
OK.
148
00:10:18,810 --> 00:10:19,440
That's it.
149
00:10:21,650 --> 00:10:26,540
So that's about the decrement operation, very similar to the increment.
150
00:10:26,990 --> 00:10:31,310
It will be called the calling to this function will also be very similar.
151
00:10:32,380 --> 00:10:33,700
OK, so I hope it's clear.
152
00:10:35,250 --> 00:10:43,080
And both of both of them of these functions were basically of a void type, since we do not return anything,
153
00:10:43,080 --> 00:10:47,040
we work on the same variable, so we send the address of these variable.
154
00:10:48,330 --> 00:10:55,380
Later on, we have these addition function and these additions function basically receives two rational
155
00:10:55,380 --> 00:11:00,330
variables, calculates the addition of both of them and returns the result.
156
00:11:01,230 --> 00:11:07,200
So what you need to understand is whenever you are going to work with two rational numbers, let's say
157
00:11:07,200 --> 00:11:13,740
we will call the first one and one divided by one, which is numerator one divided by denominator one.
158
00:11:13,980 --> 00:11:22,020
This is the representation of just one rational number, and we want to add to it another rational number
159
00:11:22,020 --> 00:11:24,540
and to divide it by two.
160
00:11:25,410 --> 00:11:33,930
So the way you do it is not just like this and one plus and two and D two d one plus the two.
161
00:11:34,200 --> 00:11:35,310
That's not how you do it.
162
00:11:35,760 --> 00:11:36,150
OK.
163
00:11:36,180 --> 00:11:37,200
That's not I.
164
00:11:37,770 --> 00:11:40,530
Basically, it's not something that I have invented.
165
00:11:41,160 --> 00:11:41,940
That's math.
166
00:11:42,450 --> 00:11:42,790
OK.
167
00:11:42,810 --> 00:11:48,650
So there are strict rules that we should follow and how it's going to look like.
168
00:11:48,660 --> 00:11:54,750
First of all, we do some common ground, some common denominator and the common denominator of the
169
00:11:54,750 --> 00:11:55,530
result.
170
00:11:55,560 --> 00:11:55,950
OK.
171
00:11:56,790 --> 00:12:02,580
This is this is the first rational number are one.
172
00:12:03,060 --> 00:12:09,090
This is going to be our two and this is going to be.
173
00:12:10,350 --> 00:12:12,660
The final result.
174
00:12:13,200 --> 00:12:22,620
OK, so the final result denominator is going to be one multiplied by two, and the numerator of the
175
00:12:22,620 --> 00:12:31,410
result is going to be in one multiplied by 0.2 plus and two multiplied by one.
176
00:12:32,130 --> 00:12:32,880
That's math.
177
00:12:33,300 --> 00:12:34,260
Ladies and gentlemen.
178
00:12:35,130 --> 00:12:40,890
OK, so we create a variable called result of rational type.
179
00:12:41,490 --> 00:12:45,930
This variable has field's denominator and nominate numerator.
180
00:12:46,940 --> 00:12:54,980
So we will calculate the result field result dot denominator will be equal to our one dot denominator
181
00:12:54,980 --> 00:12:57,710
multiplied by our two dot denominator.
182
00:12:58,250 --> 00:12:59,240
This is it.
183
00:12:59,390 --> 00:13:00,500
This is this part.
184
00:13:01,130 --> 00:13:03,620
And also we calculate the numerator.
185
00:13:04,100 --> 00:13:05,060
How do we do it?
186
00:13:05,360 --> 00:13:13,070
We say resolved dot numerator, which is this part, will be equal to our one numerator, which is and
187
00:13:13,070 --> 00:13:15,290
one multiplied by our 2.9.
188
00:13:15,290 --> 00:13:19,790
I mean, the denominator, which is the two plus are two.
189
00:13:20,950 --> 00:13:24,430
Numerator multiplied by our one denominator.
190
00:13:24,910 --> 00:13:28,240
And then we calculated the result numerator.
191
00:13:28,930 --> 00:13:29,680
That's math.
192
00:13:29,890 --> 00:13:32,500
Once again, math, math, math.
193
00:13:32,920 --> 00:13:36,610
There are rules for working with rational numbers.
194
00:13:37,780 --> 00:13:40,540
We just need to understand them.
195
00:13:40,930 --> 00:13:49,480
And then to use these rules and construct and create and develop different functions in our programming
196
00:13:49,480 --> 00:13:50,080
language.
197
00:13:50,830 --> 00:13:53,650
OK, so that said about rational edition.
198
00:13:54,190 --> 00:13:55,540
And we return.
199
00:13:55,540 --> 00:14:03,670
The return type is rational because we return some value, which is of type rational, some variable.
200
00:14:04,480 --> 00:14:14,140
I'm not talking about in this example, whether it be it will be more if it will be better to use here,
201
00:14:14,140 --> 00:14:16,240
a pointer or references and so on.
202
00:14:16,610 --> 00:14:17,280
Doesn't matter.
203
00:14:17,290 --> 00:14:23,200
OK, for now, let's use it as simple as this just to demonstrate the usage of these functions.
204
00:14:23,890 --> 00:14:25,390
OK, good.
205
00:14:25,780 --> 00:14:30,040
So the function call itself, for this part, is going to look like this.
206
00:14:30,730 --> 00:14:35,650
Let me just show you the function call is going to look like this.
207
00:14:35,680 --> 00:14:39,730
OK, suppose that you have created rational are one.
208
00:14:40,880 --> 00:14:47,690
Which will be equal to one three and are a two, which will be equal to two and five.
209
00:14:48,620 --> 00:14:58,790
So then the result you will create rational are three will be equal to what two rational additions of
210
00:14:58,790 --> 00:15:01,550
who are one and are to.
211
00:15:03,060 --> 00:15:03,660
That's it.
212
00:15:04,290 --> 00:15:12,210
And then in our three, there will be the result of the addition between these two between these two
213
00:15:12,210 --> 00:15:13,260
rational numbers.
214
00:15:14,690 --> 00:15:15,140
OK.
215
00:15:16,500 --> 00:15:23,880
Who I hope I hope you're following me so far because we are just getting like another one after the
216
00:15:23,880 --> 00:15:30,150
other, but it's very important for you to understand each and every step here so you can feel free
217
00:15:30,150 --> 00:15:31,230
to stop these video.
218
00:15:31,440 --> 00:15:34,500
Watch it once again and then replayed and so on.
219
00:15:34,950 --> 00:15:35,220
OK.
220
00:15:36,610 --> 00:15:37,030
Awesome.
221
00:15:37,630 --> 00:15:41,440
So this party's over, but we are not done yet.
222
00:15:41,860 --> 00:15:45,370
There are additional seven functions that we need to follow.
223
00:15:45,940 --> 00:15:48,100
So let's go over them quickly.
224
00:15:49,000 --> 00:15:54,190
The next one is basically this obstruction subtraction.
225
00:15:55,000 --> 00:15:59,080
So what we do here is basically we do a subtraction operation.
226
00:15:59,080 --> 00:16:03,940
We take our one minus our two, also a mathematical operation.
227
00:16:04,210 --> 00:16:07,100
Very, very similar to addiction operation.
228
00:16:07,450 --> 00:16:15,160
We simply take two regional numbers and one d one minus and two D2.
229
00:16:15,370 --> 00:16:23,590
And the result is very simple it's d one multiplied by D two and and one multiplied by D two minus and
230
00:16:23,590 --> 00:16:26,800
two and two multiplied by D one.
231
00:16:27,370 --> 00:16:28,960
That's exactly what we've written here.
232
00:16:29,410 --> 00:16:32,440
This is and one this is.
233
00:16:33,680 --> 00:16:36,490
What is it, D2, right?
234
00:16:36,650 --> 00:16:40,640
And one multiplied by D, two places and two.
235
00:16:41,210 --> 00:16:49,790
This is the one so and one multiplied by two minus and two multiplied by the one that should be the
236
00:16:49,790 --> 00:16:51,530
numerator of the result.
237
00:16:53,390 --> 00:16:59,300
And regarding the denominator, it should be the one multiplied by the deal, and that's exactly what
238
00:16:59,300 --> 00:17:00,620
we can see in this line.
239
00:17:00,800 --> 00:17:02,570
Three, eight six.
240
00:17:03,580 --> 00:17:07,720
D1 multiplied by D2 returning the result.
241
00:17:08,440 --> 00:17:14,740
OK, so this is not about subtraction operation in the function call, it's very similar to this one.
242
00:17:15,310 --> 00:17:20,320
Just like this instead of fractional ED. You simply write down rational subtraction.
243
00:17:21,860 --> 00:17:24,610
OK, then you use multiplication.
244
00:17:24,680 --> 00:17:30,080
Multiplication, so in multiplication, that's very, very simple.
245
00:17:30,770 --> 00:17:33,110
You simply take if you need to multiply.
246
00:17:33,440 --> 00:17:37,970
Let's see one rational number by the other.
247
00:17:39,540 --> 00:17:43,440
Then the result is very simple, it should be and one multiplied by into.
248
00:17:44,540 --> 00:17:49,010
In two and divided by one, multiplied by two.
249
00:17:49,310 --> 00:17:49,850
That's it.
250
00:17:50,840 --> 00:17:52,340
And that's exactly what we do here.
251
00:17:52,700 --> 00:17:59,510
We get to rational numbers, are one in Iowa to multiply, the denominator is putting it into result
252
00:17:59,530 --> 00:18:00,590
that denominator.
253
00:18:01,040 --> 00:18:06,710
And also we multiply the numerator us and then put the result into the numerator of field.
254
00:18:07,690 --> 00:18:08,350
That's what we do.
255
00:18:09,450 --> 00:18:09,900
Awesome.
256
00:18:10,230 --> 00:18:11,430
So let's proceed.
257
00:18:11,910 --> 00:18:13,440
Now we have the lesion.
258
00:18:14,600 --> 00:18:21,680
Night vision operations, very, very, very similar to multiplication, just that it works a little
259
00:18:21,680 --> 00:18:22,340
bit different.
260
00:18:22,970 --> 00:18:30,560
So we have in one divided by one and we try to divide it by and two divided by two.
261
00:18:31,880 --> 00:18:39,290
So the result of this is basically in one divided by one, multiplied by what?
262
00:18:40,690 --> 00:18:43,150
By D2 divided by into.
263
00:18:44,150 --> 00:18:44,400
OK.
264
00:18:44,420 --> 00:18:51,500
We simply flip this regional number when we use day vision and then we use simply multiplication.
265
00:18:52,490 --> 00:18:58,310
So the answer, whether this is going to be and one multiplied by two, divided by one, multiplied
266
00:18:58,310 --> 00:18:59,060
by end to.
267
00:19:00,030 --> 00:19:06,750
So the denominator is going to be the one denominator, one multiplied by numerator to.
268
00:19:08,110 --> 00:19:15,370
And the numerator of the result is going to be numerator one numerator, one multiplied by denominator
269
00:19:15,370 --> 00:19:15,670
to.
270
00:19:16,930 --> 00:19:18,430
OK, very, very simple.
271
00:19:19,630 --> 00:19:25,300
We could also to take advantage of using racial division by simply leaping one of them.
272
00:19:25,690 --> 00:19:30,760
OK, the second one and then calling the regional multiplication between the flipped one and on one.
273
00:19:31,030 --> 00:19:33,190
But let's keep it simple.
274
00:19:33,460 --> 00:19:34,380
That's also an option.
275
00:19:34,390 --> 00:19:37,900
I'm not saying no, but for now, that's the way we solve it.
276
00:19:39,010 --> 00:19:40,030
Let's move on.
277
00:19:40,030 --> 00:19:43,090
We ha we have a little bit left.
278
00:19:44,000 --> 00:19:48,580
So, yeah, I think most of them are the same, pretty much the same.
279
00:19:48,580 --> 00:19:50,830
So it will be easier to explain.
280
00:19:51,790 --> 00:20:00,850
So in this function, what we want to do is to kind of simulate the comparison of if our one is smaller
281
00:20:00,850 --> 00:20:01,660
than our two.
282
00:20:01,690 --> 00:20:04,240
So we call this function smaller, rational.
283
00:20:05,170 --> 00:20:08,320
And what we want to do is to ask a simple question if.
284
00:20:09,570 --> 00:20:11,010
One regional number.
285
00:20:11,340 --> 00:20:11,760
OK.
286
00:20:11,800 --> 00:20:14,040
Ah, one is less than.
287
00:20:15,290 --> 00:20:18,070
Another rational number are two.
288
00:20:18,820 --> 00:20:19,930
That's what we want to do.
289
00:20:21,010 --> 00:20:22,390
So how you would do it?
290
00:20:22,840 --> 00:20:27,580
You do not simply ask if in one is smaller than in two and Diwan is smaller than the two.
291
00:20:28,180 --> 00:20:35,110
That's not how you compare who is greater and who is smaller using rational numbers.
292
00:20:35,530 --> 00:20:38,040
Once again, these are math rules.
293
00:20:38,050 --> 00:20:39,970
That's not something I've invented.
294
00:20:40,420 --> 00:20:41,890
OK, so.
295
00:20:43,350 --> 00:20:52,320
So, OK, so what do we have to do in order to give an answer to this question is to make for both of
296
00:20:52,320 --> 00:20:53,730
them some common ground?
297
00:20:54,750 --> 00:20:55,000
OK.
298
00:20:55,050 --> 00:20:58,440
There are also additional ways that we can do it, additional techniques.
299
00:20:58,740 --> 00:21:00,720
But I'm going to show you some basic technique.
300
00:21:00,960 --> 00:21:05,160
So we make a common ground for oops, why did it become bigger?
301
00:21:06,850 --> 00:21:12,040
So we take these no, and we represented by doing the following.
302
00:21:12,080 --> 00:21:15,610
OK, let me just make it smaller so everything will fit.
303
00:21:15,820 --> 00:21:22,690
So and one the one hand and two D2 assuming that we know that all of them are positive.
304
00:21:22,970 --> 00:21:30,460
OK, so what we ask is the following question we want to represent it as this, we want to say, and
305
00:21:30,460 --> 00:21:36,100
one divided by one, and we will multiplied by d two, divided by two.
306
00:21:36,610 --> 00:21:43,570
We can do it right because the value of it is one, and multiplying the any value by one will not change
307
00:21:43,570 --> 00:21:44,560
the value itself.
308
00:21:44,980 --> 00:21:45,310
Right.
309
00:21:46,240 --> 00:21:52,820
And we do on the same side here, pretty much the same just when multiplied by d one, divided by D
310
00:21:52,840 --> 00:21:53,080
one.
311
00:21:54,790 --> 00:22:03,730
OK, also, that's just one we can do it so and one multiplied by two, divided by one, multiplied
312
00:22:03,730 --> 00:22:04,420
by two.
313
00:22:05,290 --> 00:22:08,800
And then we take a look here and we see and divided by d one.
314
00:22:10,140 --> 00:22:17,370
Multiplied by the want and multiplied by two, that means that here we have common.
315
00:22:19,740 --> 00:22:20,490
Dear.
316
00:22:21,240 --> 00:22:24,540
No, me neither.
317
00:22:24,570 --> 00:22:26,580
We have a common denominator.
318
00:22:27,870 --> 00:22:35,460
And once we have a common denominator, we can decide which of these rational number is greater or smaller
319
00:22:35,910 --> 00:22:42,420
just by comparing the denominator, the numerator, okay, just by comparing these parts.
320
00:22:42,630 --> 00:22:44,460
We can decide who is greater.
321
00:22:44,970 --> 00:22:48,120
So that's exactly what we've done here in these lines.
322
00:22:48,750 --> 00:22:52,490
We calculated the R one denominator to the enemy.
323
00:22:52,980 --> 00:22:54,570
OK, we simply expanded it.
324
00:22:56,190 --> 00:22:57,180
And representing.
325
00:22:57,480 --> 00:23:04,380
Now this is our one, and it has the same values here, just in a different representation.
326
00:23:04,740 --> 00:23:12,690
And this is R2 the same as here, just differently represented with the same denominator for both of
327
00:23:12,690 --> 00:23:12,900
them.
328
00:23:14,210 --> 00:23:21,050
So what we do now is simply ask if this updated numerator, which is in one multiplied by two?
329
00:23:21,650 --> 00:23:22,250
This is it.
330
00:23:23,120 --> 00:23:25,100
It has been updated right here.
331
00:23:25,820 --> 00:23:26,240
OK.
332
00:23:26,870 --> 00:23:29,420
If it's smaller than this one, return one.
333
00:23:30,980 --> 00:23:39,980
If it's not returned, zero one means that our one is smaller than our two zero means that it's not
334
00:23:39,980 --> 00:23:41,090
smaller than our two.
335
00:23:41,600 --> 00:23:42,170
That's it.
336
00:23:42,920 --> 00:23:43,340
OK.
337
00:23:44,300 --> 00:23:49,640
And the way you call these function is simply, you write down smaller, rational are one or two basically
338
00:23:49,640 --> 00:23:51,770
on some two rational numbers that you use?
339
00:23:51,950 --> 00:23:52,670
And that's it.
340
00:23:54,240 --> 00:24:02,610
And in a very similar way, you do the same or finding out larger regional.
341
00:24:02,980 --> 00:24:05,220
OK, let me simply remove it from here.
342
00:24:05,790 --> 00:24:07,050
Very, very simple.
343
00:24:07,290 --> 00:24:08,550
Very, very similar.
344
00:24:08,850 --> 00:24:13,950
I simply copied it from the previous one and just changed the sign.
345
00:24:14,160 --> 00:24:20,100
That's what we want to check out now is simply instead of this sign, we are looking for this sign.
346
00:24:20,700 --> 00:24:21,240
That's it.
347
00:24:21,960 --> 00:24:24,900
Of course, there are out there techniques that you can solve it.
348
00:24:25,290 --> 00:24:29,970
This one, I think, is not the most complicated, hopefully.
349
00:24:30,780 --> 00:24:32,610
So let me know if you have any suggestions.
350
00:24:33,000 --> 00:24:36,780
But either way, this is good and this is good.
351
00:24:37,230 --> 00:24:39,390
And now we can proceed to the last one.
352
00:24:40,680 --> 00:24:43,290
Which are also very, very similar.
353
00:24:43,650 --> 00:24:47,310
These are the equality and not equality signs.
354
00:24:48,060 --> 00:24:55,110
So once again here, whenever you want to check if two regional numbers are equal to one another, that's
355
00:24:55,110 --> 00:25:01,710
not enough to ask if just the numerator equals to the other numerator and denominator equals to another
356
00:25:01,710 --> 00:25:02,430
denominator.
357
00:25:03,000 --> 00:25:07,800
OK, although that's one option, but we can also say that.
358
00:25:09,020 --> 00:25:14,150
These two are rational numbers, four divided by two.
359
00:25:14,390 --> 00:25:17,120
And let's say eight divided by four.
360
00:25:17,510 --> 00:25:19,730
They are also kind of the same.
361
00:25:20,390 --> 00:25:20,840
OK, right?
362
00:25:20,840 --> 00:25:25,700
Because this is two and this is also two if we take a look at it.
363
00:25:26,760 --> 00:25:32,000
So this way, we kind of also solve this problem.
364
00:25:32,900 --> 00:25:34,820
And finally, these are not equal.
365
00:25:34,820 --> 00:25:41,270
Rational can also be can also be very similar to these one.
366
00:25:41,270 --> 00:25:48,710
We simply make some common ground, some common denominator and compare between the new updated and
367
00:25:48,710 --> 00:25:51,560
extended numerator is that's what we do.
368
00:25:53,860 --> 00:25:57,670
So we are done with this functions.
369
00:25:58,300 --> 00:26:03,250
And now what you need to understand is that, first of all, to make sure that everything is clear in
370
00:26:03,280 --> 00:26:10,030
terms of math, then that everything is clear in terms of the functions, names and the purposes, and
371
00:26:10,030 --> 00:26:13,420
there are types and what they receive and what they return and so on.
372
00:26:15,240 --> 00:26:21,940
And lastly, understand that these exercise can also be extended and we can add like operations like
373
00:26:22,710 --> 00:26:29,760
ARM Irrational Number and then we can also add like a function called reduce to simply if we have these
374
00:26:29,760 --> 00:26:35,760
value OK, instead of keeping it this way, we can reduce it to be like one divided by three.
375
00:26:36,390 --> 00:26:38,040
But that's not for this video.
376
00:26:38,280 --> 00:26:40,410
That's something you can do also on your own.
377
00:26:40,560 --> 00:26:42,640
Or maybe we will do another video.
378
00:26:42,810 --> 00:26:43,680
Not sure about it?
379
00:26:43,680 --> 00:26:44,490
Probably not.
380
00:26:45,060 --> 00:26:49,650
But yeah, this is it for it, right down the main function.
381
00:26:50,760 --> 00:26:54,930
Make some plays with various rational numbers.
382
00:26:54,960 --> 00:26:58,470
Make sure that you can call these functions that they work appropriately.
383
00:26:58,830 --> 00:27:00,750
And let me know if you have any questions.
384
00:27:00,990 --> 00:27:02,070
I hope you like this.
385
00:27:02,070 --> 00:27:07,540
VIDEO This was a very comprehensive solution that took us some time.
386
00:27:07,560 --> 00:27:09,000
I don't know how much time.
387
00:27:10,220 --> 00:27:16,370
But it took us some time, I think it was about half an hour, but we cover it up a lot of things.
388
00:27:16,850 --> 00:27:23,270
So once again, guys, I hope this effort will pay off and that you will find this information useful.
389
00:27:23,690 --> 00:27:29,510
Please let me know if you like this VIDEO If you have any suggestions, if you have any questions,
390
00:27:30,320 --> 00:27:32,900
leave some feedback, some review that helps me.
391
00:27:32,900 --> 00:27:36,080
A lot keeps me kind of.
392
00:27:37,280 --> 00:27:43,370
Wanting to work more and to give you more value and more content, more updates and so on.
393
00:27:43,910 --> 00:27:45,590
So thank you, guys.
394
00:27:45,620 --> 00:27:46,550
My name is Vlad.
395
00:27:46,610 --> 00:27:47,690
Keep on practicing.
396
00:27:47,720 --> 00:27:51,440
Keep on moving forward and you are bound to succeed.
397
00:27:52,070 --> 00:27:53,690
I'll see you next time.
35506
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.