1
00:00:10,000 --> 00:00:11,000
Hello, friends.

2
00:00:11,000 --> 00:00:23,000
Today we discuss about different functions available in Python Math Library and how we can call these

3
00:00:23,000 --> 00:00:26,000
in two levels for that purpose.

4
00:00:26,000 --> 00:00:40,000
I just go to my python cell and over here I just first I want to go to my folder as you see, or here

5
00:00:40,000 --> 00:00:42,000
I have my folder.

6
00:00:42,000 --> 00:00:48,000
I just copy the already created edition code.

7
00:00:49,000 --> 00:00:52,000
Just copy and place it over here.

8
00:00:53,000 --> 00:00:56,000
Right now, I just change the name.

9
00:00:56,000 --> 00:00:58,000
Let's see the math.

10
00:01:00,000 --> 00:01:01,000
Okay.

11
00:01:01,000 --> 00:01:03,000
So right now, the name is changed.

12
00:01:03,000 --> 00:01:10,000
And over here in the python cell, I want to call the function p mac.

13
00:01:10,000 --> 00:01:16,000
So just to go to the commands by ten, like deletion by code.

14
00:01:16,000 --> 00:01:19,000
And over here, this is my addition code.

15
00:01:20,000 --> 00:01:21,000
So right now.

16
00:01:22,000 --> 00:01:27,000
I want to just first check in the python cell.

17
00:01:28,000 --> 00:01:32,000
Different functions available in my library.

18
00:01:32,000 --> 00:01:35,000
So first I import.

19
00:01:39,000 --> 00:01:47,000
Math function, then directly available in math.

20
00:01:49,000 --> 00:02:00,000
So just as you see over here, I got the different math functions available in Python math directory.

21
00:02:01,000 --> 00:02:05,000
Okay, so let's say, oh, here, this is exponential.

22
00:02:06,000 --> 00:02:08,000
This is course function.

23
00:02:08,000 --> 00:02:11,000
This is factorial.

24
00:02:11,000 --> 00:02:12,000
This is flow.

25
00:02:13,000 --> 00:02:26,000
And over here, this is log log ten log base to like this power by radians remainder sine ten.

26
00:02:27,000 --> 00:02:27,000
Okay.

27
00:02:27,000 --> 00:02:33,000
So right now I just want to work with different functions.

28
00:02:33,000 --> 00:02:36,000
So let's say I have my result.

29
00:02:36,000 --> 00:02:39,000
Let's say R is equal to zero.

30
00:02:40,000 --> 00:02:51,000
And in this first function I'm using or here is, let's say, my power.

31
00:02:52,000 --> 00:02:53,000
Okay.

32
00:02:53,000 --> 00:02:54,000
The function name is power.

33
00:02:54,000 --> 00:03:04,000
And over here I'm just using only single variable X, and my result is R.

34
00:03:05,000 --> 00:03:06,000
And that is equal to.

35
00:03:08,000 --> 00:03:09,000
The old view.

36
00:03:11,000 --> 00:03:15,000
Power of X.

37
00:03:16,000 --> 00:03:23,000
And right now, I want to return my function, as you see.

38
00:03:23,000 --> 00:03:26,000
So right now, I just print this

39
00:03:30,000 --> 00:03:31,000
brain.

40
00:03:32,000 --> 00:03:40,000
The function are to check the value, and I want to return my function power.

41
00:03:41,000 --> 00:03:42,000
Let's see.

42
00:03:43,000 --> 00:03:47,000
In this case, for the power, I acquired variables.

43
00:03:47,000 --> 00:03:50,000
So X and Y over here.

44
00:03:50,000 --> 00:03:52,000
X, y.

45
00:03:52,000 --> 00:03:57,000
And over here, let's say two days, two, three, two, comma, three.

46
00:03:57,000 --> 00:03:58,000
Control s.

47
00:03:58,000 --> 00:04:01,000
Now run it at all.

48
00:04:01,000 --> 00:04:01,000
Five.

49
00:04:02,000 --> 00:04:04,000
As you see, I got it.

50
00:04:04,000 --> 00:04:07,000
So it is okay right now.

51
00:04:07,000 --> 00:04:11,000
So let's check for another function.

52
00:04:11,000 --> 00:04:13,000
So just delete this.

53
00:04:14,000 --> 00:04:15,000
Just note.

54
00:04:16,000 --> 00:04:18,000
This is okay.

55
00:04:18,000 --> 00:04:19,000
Right now.

56
00:04:19,000 --> 00:04:25,000
Another function, let's say R one is equal to zero.

57
00:04:25,000 --> 00:04:31,000
So I just copy this result and put it over here.

58
00:04:31,000 --> 00:04:37,000
And right now my function is, let's say, sine function.

59
00:04:38,000 --> 00:04:39,000
I put it as I.

60
00:04:39,000 --> 00:04:43,000
And over here, in this case, my variable is single variable.

61
00:04:43,000 --> 00:04:47,000
And I just use math function.

62
00:04:47,000 --> 00:04:57,000
So math not sine because in the directory it is even over here as you sine function is there.

63
00:04:57,000 --> 00:05:07,000
So sine of x is there and I want to return with my R one over here and r1i want to put over here.

64
00:05:07,000 --> 00:05:11,000
So this is my sign of x, it will give me sign of x.

65
00:05:11,000 --> 00:05:22,000
So like this I just copy and place over here my another function let's say over here is radians.

66
00:05:22,000 --> 00:05:24,000
So I just use this.

67
00:05:24,000 --> 00:05:28,000
So in this case, I just go back to my python code.

68
00:05:28,000 --> 00:05:33,000
And over here, in the place of sine, I just put radians.

69
00:05:33,000 --> 00:05:42,000
And over here I want to make function name R a D, and the result is my R too.

70
00:05:43,000 --> 00:05:50,000
I want to call back R to return and over here my r two is equal to zero initial value.

71
00:05:50,000 --> 00:05:55,000
So let's say another function is my

72
00:05:58,000 --> 00:06:05,000
so go back to the directory or here let's say I want to go for square root.

73
00:06:05,000 --> 00:06:14,000
Okay, so I just copy this square root and over here in the place of radians I just put square root

74
00:06:14,000 --> 00:06:25,000
right now r three is there, so r three is there and in this case I'll just use a skew r d let's say

75
00:06:25,000 --> 00:06:27,000
so right now function is ready.

76
00:06:27,000 --> 00:06:31,000
Let's go for some another function also.

77
00:06:31,000 --> 00:06:33,000
Let's see, I want to go for low ten.

78
00:06:34,000 --> 00:06:37,000
Okay, so just copy this log.

79
00:06:37,000 --> 00:06:42,000
I know some value so I just put it over here.

80
00:06:42,000 --> 00:06:53,000
Then copy this function and over here control X and over here math function log ten.

81
00:06:53,000 --> 00:06:55,000
My code is ready.

82
00:06:55,000 --> 00:07:06,000
And over here this is let's say L or G low and the result is for r four or here I also put our code

83
00:07:06,000 --> 00:07:10,000
and in this case over here are three should be zero.

84
00:07:12,000 --> 00:07:16,000
Initial value and are four is also zero.

85
00:07:17,000 --> 00:07:18,000
So my code is ready.

86
00:07:18,000 --> 00:07:21,000
So right now I just save it.

87
00:07:21,000 --> 00:07:27,000
So go back to folder and over here this is my map.

88
00:07:28,000 --> 00:07:30,000
So I just open it.

89
00:07:32,000 --> 00:07:33,000
Control.

90
00:07:34,000 --> 00:07:35,000
And over here.

91
00:07:35,000 --> 00:07:42,000
I just hope we met in this because it will call the python code.

92
00:07:42,000 --> 00:07:53,000
I want to just edit this icon or here in this case, let's say it is functions from the python's just

93
00:07:53,000 --> 00:08:00,000
okay control as this is done right now, go back to the main code.

94
00:08:00,000 --> 00:08:12,000
Let's say I want to just copy this code, put it over here and rename it to the python code by ten math

95
00:08:12,000 --> 00:08:12,000
code.

96
00:08:12,000 --> 00:08:13,000
Let's see.

97
00:08:13,000 --> 00:08:18,000
And in this python math code, just open it.

98
00:08:18,000 --> 00:08:29,000
So I just go to the program and over here I want to just delete this part, control B and I want to

99
00:08:29,000 --> 00:08:33,000
delete this part because I want to vary the function name.

100
00:08:33,000 --> 00:08:39,000
So for that purpose I just create a combo box over here.

101
00:08:39,000 --> 00:08:49,000
And I also know that the different functions available in my system are power sine gradient, square

102
00:08:49,000 --> 00:08:50,000
root and lock.

103
00:08:50,000 --> 00:08:54,000
So let's put these values inside the combo box.

104
00:08:54,000 --> 00:09:12,000
So for that purpose I just added insert power the next sign, the next gradient, the next log, the

105
00:09:12,000 --> 00:09:16,000
next is to are askew.

106
00:09:16,000 --> 00:09:29,000
Ah, so my functions are ready and over here let's say I want to make square root default it operation

107
00:09:29,000 --> 00:09:31,000
make current value default.

108
00:09:31,000 --> 00:09:45,000
So I just copy or connect this function to the function and I want to call the sub v from here.

109
00:09:46,000 --> 00:09:50,000
Just copy this and drag and drop to my

110
00:09:54,000 --> 00:09:55,000
block diagram.

111
00:09:56,000 --> 00:09:58,000
Just connect this control u.

112
00:09:58,000 --> 00:10:03,000
So right now code is ready, so just check for it.

113
00:10:03,000 --> 00:10:08,000
Let's say I want to check for the power first.

114
00:10:08,000 --> 00:10:12,000
So the input value is let's say two days to three, so run it.

115
00:10:13,000 --> 00:10:23,000
So as you see I got the value eight and in the next case I want to check, let's say for the square

116
00:10:23,000 --> 00:10:24,000
root.

117
00:10:28,000 --> 00:10:28,000
For the law.

118
00:10:31,000 --> 00:10:35,000
So in this case, it is not working for that purpose.

119
00:10:35,000 --> 00:10:43,000
I just stop it because as you see, there was an error in executing the specified function.

120
00:10:44,000 --> 00:10:47,000
The python returns the class type where this.

121
00:10:48,000 --> 00:10:50,000
Okay, so stop it.

122
00:10:50,000 --> 00:10:51,000
So let's.

123
00:10:53,000 --> 00:10:54,000
You name it.

124
00:10:55,000 --> 00:11:04,000
And I want to just delete this y function and just check for the value in this case.

125
00:11:05,000 --> 00:11:07,000
Controller's Control dx.

126
00:11:07,000 --> 00:11:09,000
Let's check for this.

127
00:11:11,000 --> 00:11:12,000
What is the value of log two?

128
00:11:25,000 --> 00:11:29,000
It is giving some error or here.

129
00:11:30,000 --> 00:11:34,000
So we have to just make the code.

130
00:11:37,000 --> 00:11:40,000
We have changed the code over here.

131
00:11:40,000 --> 00:11:45,000
So as you see, power is working perfectly in this case.

132
00:11:45,000 --> 00:11:47,000
Something is missing.

133
00:11:47,000 --> 00:11:49,000
I want to import.

134
00:11:51,000 --> 00:11:56,000
So first I want to again change control Z.

135
00:11:57,000 --> 00:12:04,000
Control Z, because I want to put the code same.

136
00:12:05,000 --> 00:12:11,000
So right now I want to import math function over here.

137
00:12:11,000 --> 00:12:18,000
So if math function is not there, these functions will not work properly.

138
00:12:18,000 --> 00:12:20,000
Control s right now.

139
00:12:20,000 --> 00:12:22,000
Just close it.

140
00:12:22,000 --> 00:12:31,000
Go to your lab view and let's say I want to check for the results or the log log do.

141
00:12:37,000 --> 00:12:39,000
Let's check for the square root.

142
00:12:41,000 --> 00:12:44,000
This is x my x value.

143
00:12:47,000 --> 00:12:49,000
Let's check for the power.

144
00:12:52,000 --> 00:12:53,000
There is some error.

145
00:12:56,000 --> 00:12:57,000
Stop it.

146
00:12:57,000 --> 00:13:04,000
So again, I want to open the python code.

147
00:13:08,000 --> 00:13:11,000
Python integration by code.

148
00:13:12,000 --> 00:13:24,000
By Matt I import math function define function return are one or two or three or four.

149
00:13:25,000 --> 00:13:30,000
Let's check for the sine function in the python.

150
00:13:30,000 --> 00:13:33,000
So for that purpose, print

151
00:13:36,000 --> 00:13:48,000
are one and I want to come with sign off, let's say one.

152
00:13:49,000 --> 00:13:53,000
So run it and check the output.

153
00:13:54,000 --> 00:14:00,000
As you see I got the value is OC or here and the same.

154
00:14:01,000 --> 00:14:05,000
I want to go for the gradients.

155
00:14:06,000 --> 00:14:07,000
So print

156
00:14:10,000 --> 00:14:14,000
and over here I want to go with R2.

157
00:14:14,000 --> 00:14:22,000
And over here, let's say radians or 80 or eight.

158
00:14:23,000 --> 00:14:27,000
Let's check right before running it.

159
00:14:27,000 --> 00:14:28,000
I want to save it.

160
00:14:28,000 --> 00:14:35,000
So as you see, when you go to the value of and also so the code is working properly.

161
00:14:35,000 --> 00:14:37,000
So let's say go for print.

162
00:14:40,000 --> 00:14:53,000
Are for and the value for the function low is, let's say ten again.

163
00:14:53,000 --> 00:14:56,000
Run the module, check for the value.

164
00:14:56,000 --> 00:14:59,000
In this case, log ten is equal to one.

165
00:14:59,000 --> 00:15:01,000
The code is working properly.

166
00:15:01,000 --> 00:15:05,000
Python code so control as it is be met.

167
00:15:06,000 --> 00:15:07,000
Close this.

168
00:15:07,000 --> 00:15:09,000
Go to over here.

169
00:15:09,000 --> 00:15:10,000
Let's check the path.

170
00:15:11,000 --> 00:15:19,000
The math is working properly close this right now the combo box contains different functions.

171
00:15:19,000 --> 00:15:27,000
Or here I have x, y and this is my function's function, let's say.

172
00:15:28,000 --> 00:15:34,000
So let's say I want to go for ten and in this case the log of ten.

173
00:15:40,000 --> 00:15:44,000
And if I want to go for power is not working.

174
00:15:46,000 --> 00:15:59,000
Maybe some error controller's math or by python it says or here let's want to delete this control b

175
00:16:00,000 --> 00:16:04,000
let's check for this value controllers.

176
00:16:04,000 --> 00:16:09,000
So let's check for the square root of ten.

177
00:16:10,000 --> 00:16:17,000
It is working because over here only one variable is needed.

178
00:16:17,000 --> 00:16:20,000
So right now SQL is working.

179
00:16:20,000 --> 00:16:24,000
Let's say for low is working.

180
00:16:24,000 --> 00:16:26,000
Radians is working.

181
00:16:26,000 --> 00:16:28,000
Sine function is working.

182
00:16:29,000 --> 00:16:31,000
But the power is not working.

183
00:16:31,000 --> 00:16:34,000
Because in this case, I need two variables.

184
00:16:34,000 --> 00:16:41,000
So in the python you have to create functions for the same variable.

185
00:16:41,000 --> 00:16:48,000
If you want to go for multiple variable in the same function, you have to call another combo works.

186
00:16:48,000 --> 00:16:49,000
Okay.

187
00:16:49,000 --> 00:16:53,000
So for that purpose, I also create another VI.

188
00:16:54,000 --> 00:16:55,000
Okay.

189
00:16:55,000 --> 00:16:58,000
So this is for now.

190
00:16:58,000 --> 00:16:59,000
Thank you.

