1
00:00:00,120 --> 00:00:06,660
So let's get started with our crash course attached to this lecture, you find a file that was named

2
00:00:06,660 --> 00:00:09,810
Crash Course Dot IPY, N.B..

3
00:00:10,470 --> 00:00:16,350
Download this file and save it on your hard disk drive and then open it in Jupyter Notebook.

4
00:00:17,010 --> 00:00:18,780
Of course, you don't have to do this.

5
00:00:18,780 --> 00:00:23,820
You can also start with a completely new file and ride along with me.

6
00:00:24,840 --> 00:00:27,990
So I think the first few lectures are really, really easy.

7
00:00:28,230 --> 00:00:34,110
So this is why I have prepared them for you, and we will just run the notes, book together to see

8
00:00:34,110 --> 00:00:34,830
what happens.

9
00:00:35,910 --> 00:00:42,290
So the first thing that we are going to do is we are going to import a module called Nampai.

10
00:00:42,810 --> 00:00:46,660
And for this, we write import Nampai.

11
00:00:47,990 --> 00:00:50,460
And this would already be sufficient.

12
00:00:50,790 --> 00:00:57,840
But in most of the notebooks that you use NumPy, they write something like import nampai, s and P.

13
00:00:58,560 --> 00:01:03,390
So this means whenever in the following, we would have to write Nampai, we just have to write and

14
00:01:03,390 --> 00:01:03,770
Pete.

15
00:01:05,129 --> 00:01:10,890
So Nampai is a module that contains many useful mathematical commands.

16
00:01:11,370 --> 00:01:18,540
For example, the constant PI or the Oilers constant or also the square root command and these commands,

17
00:01:18,540 --> 00:01:22,850
they are not initially built in to Python.

18
00:01:23,040 --> 00:01:25,380
So we first need to load them using this module.

19
00:01:25,680 --> 00:01:31,410
This is why in basically every scientific code, one of the first lines will be important Um, P, S

20
00:01:31,410 --> 00:01:32,100
and P.

21
00:01:32,820 --> 00:01:36,960
So we write this and run it using shift enter.

22
00:01:38,130 --> 00:01:41,670
And now we are going to start with some basic mathematics.

23
00:01:42,330 --> 00:01:46,740
By the way, if you wonder how I wrote this line here, I will double click.

24
00:01:47,010 --> 00:01:52,140
And you see, I just wrote with down hashtag hashtag for a subheading.

25
00:01:52,410 --> 00:02:00,480
And then my basic mathematics and I have turned to sell cell type into markdown and then press shift

26
00:02:00,480 --> 00:02:00,960
enter.

27
00:02:01,440 --> 00:02:03,840
So you will get this bold text.

28
00:02:05,160 --> 00:02:08,759
So let's continue with the very basic mathematical operations.

29
00:02:09,060 --> 00:02:13,200
I mean, I think this will be totally clear to you that a plus means addition.

30
00:02:13,200 --> 00:02:20,220
So you can use Python just like a calculator for addition, subtraction, multiplication and division.

31
00:02:21,210 --> 00:02:26,850
And you you see already that when you divide two integer numbers, it can also give you a float number

32
00:02:26,850 --> 00:02:30,360
as a result, which is not the case in every programming language.

33
00:02:30,960 --> 00:02:37,980
So for some languages, this would give us just two, because the result in this case should be an integer

34
00:02:37,980 --> 00:02:39,120
number in these languages.

35
00:02:39,900 --> 00:02:45,360
But Python is really clever about the data types and adapts on the fly, so you don't have to bother

36
00:02:45,630 --> 00:02:46,710
with these problems.

37
00:02:47,700 --> 00:02:54,840
If, however, you want to really execute an into an integer division or integral division, then you

38
00:02:54,840 --> 00:02:57,660
can write two of these dashes.

39
00:02:58,080 --> 00:03:05,180
And this will give us 10 the integer solution, which is two if you only care about the remainder or

40
00:03:05,280 --> 00:03:06,510
also called modulus.

41
00:03:06,900 --> 00:03:13,230
Then you write the percentage sign and you write five percentage two, which gives us the remainder

42
00:03:13,230 --> 00:03:15,480
of this division, which is, of course, one.

43
00:03:17,160 --> 00:03:19,980
Another important operator is, of course, the exponent.

44
00:03:19,980 --> 00:03:25,110
So if you write two of these stars, then this means three to the power of two.

45
00:03:25,290 --> 00:03:28,320
Or also this means three squared.

46
00:03:29,160 --> 00:03:32,980
So the square of three is, of course, nine and vice versa.

47
00:03:33,000 --> 00:03:40,350
You can also calculate the square root of nine by writing nine to the power of one half or 0.5.

48
00:03:41,640 --> 00:03:49,770
So here this is maybe a bit of a detail, but so Python itself does not have a square root command.

49
00:03:49,920 --> 00:03:56,760
It does not exist in the Python language, and it has to be imported with the Nampai module.

50
00:03:57,450 --> 00:04:02,400
So, for example, if we would just write something like square root of nine, which would work in most

51
00:04:02,400 --> 00:04:06,810
languages, this would give us an error because square root is not defined.

52
00:04:07,650 --> 00:04:13,080
And to use the conventional square root, we would either have to use this one here or we use Nampai

53
00:04:13,920 --> 00:04:20,910
Dot Square Root, because then it loads the square root command from the non-paid module that we have

54
00:04:20,910 --> 00:04:22,680
imported right at the top here.

55
00:04:23,760 --> 00:04:28,590
So now we can run this, and of course, it gives us three point zero as well.

56
00:04:29,850 --> 00:04:38,310
So as I mentioned, Non also contains several useful constants like Pi or E, and you can easily access

57
00:04:38,310 --> 00:04:42,450
those by writing and pitot and then the constant that you need.

58
00:04:44,070 --> 00:04:48,960
The last thing that I want to show you before we continue with the next topic will be that, of course,

59
00:04:48,960 --> 00:04:50,910
you are able to define variables.

60
00:04:51,390 --> 00:04:58,170
For example, you can just write a is some number like three and then you just write four times a minus

61
00:04:58,170 --> 00:04:59,670
five, which will give us.

62
00:04:59,750 --> 00:05:01,880
Twelve minus five is seven.

63
00:05:02,930 --> 00:05:07,220
So you see, all of this basic stuff can be done, of course, with Python.

64
00:05:07,580 --> 00:05:12,710
But you have to be careful sometimes because some of the functions that you might think are implemented

65
00:05:12,710 --> 00:05:14,870
in Python are actually not implemented.

66
00:05:15,260 --> 00:05:19,130
And for those, you will need to load a module like Nampai.

67
00:05:19,610 --> 00:05:22,340
So this would be square roots and also these constants.

