-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.n
More file actions
47 lines (38 loc) · 699 Bytes
/
math.n
File metadata and controls
47 lines (38 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
func gamma(x) {
if (x > 0) {
return factorial(x - 1)
} else {
return 0
}
}
func beta(x, y) {
var res = (gamma(x) * gamma(y)) / gamma(x + y)
return res
}
func relu(x) {
return max(0, x)
}
func combs(n, k) {
return factorial(n) / (factorial(k) * factorial(n - k))
}
func sinh(n) {
var res = ((e^n) - (e^-n)) / 2
return res
}
func cosh(n) {
var res = ((e^n) + (e^-n)) / 2
return res
}
func tanh(n) {
var res = sinh(n) / cosh(n)
return res
}
func cotanh(n) {
return (1 / tanh(n))
}
func sigmoid(x) {
return e^x / (e^(x+1))
}
func pow(num, power) {
return num^power
}