-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTODO
More file actions
304 lines (254 loc) · 6.41 KB
/
TODO
File metadata and controls
304 lines (254 loc) · 6.41 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
TODO
Coastline problem
When to automate
Why did you leave?
Redesign is the new rewrite
What problem is this solving?
Can't understand a solution if you don't understand the problem (git flow)
Burnout
People believe what they want to
Managing expectations
Block math
- even and odd
- factoring
- +, x commutivity
- staircase
- x^2 - 1
- pythagorean theorem
Reverse a one-way function with some data loss via bayesian methods
- easier if you have some idea about internal parameters
Pythagorean runs
Many worlds
bootstrap
001110100
1376524
001110100
011011100
533
000 0
001 1
010 1
011 1
100 0
101 1
110 1
111 0
01234567
10110011
Grover's algorithm
QFT
how many infinities are there?
describeable numbers
more fun examples
more experiment analysis
do-notation
markov chains
k-s test
alias method
stochastic calculus, ito calculus
kalman filter (iterated PGM), conjugate priors
beta distribution, priors, minimum entropy
more probability: http://www.amazon.com/Problems-Probability-Mathematical-Statistics-Mathematics/dp/0387735119/ref=sr_1_2?s=books&ie=UTF8&qid=1373846207&sr=1-2&keywords=40+statistics
diagram of probability distribution derivations
move non-technical posts to Medium
rewrite home page
generative models for lognormal and power law, + G-test
3 ways your A/B test can go wrong
- underlying distribution has no mean
- independence assumption
reversible computing
fib in log n (F(n) * F(n-1) is a known identity)
computational algebra
polynomial tetris?
poly in haskell
complex/quaternion/dual tower - other combinations?
automatic symbolic differentiation
linear logic https://secure.flickr.com/photos/8243148@N08/sets/72157635668011986
code: overflow-y: scroll
scala compile challenge: compile time / lines of code
val harmonic: Stream[Double] = Stream.from(1).map(n => 1.0 / n)
def kahan(xs: Seq[Double]): (Double, Double) = {
xs.foldLeft((0.0, 0.0)){ case ((sum, carry), x) => {
val x2 = x - carry
val newSum = sum + x2
(newSum, (newSum - sum) - x2)
}}
}
val rs: Stream[Rational] = Stream.from(1).map(n => Rational(1, n))
def extend(s: List[Int => Int]): Int => (Int => Int) = {
(n: Int) => if (n < s.size) s(n) else zero
}
def invert(inj: (Int => Int) => Int): List[Int => Int] = {
def helper(s: List[Int => Int]): List[Int => Int] = {
if (H(diag(extend(s))) < s.size) {
s
} else {
val r = helper(s ++ List(zero))
val dr = diag(extend(r))
if (H(dr) != s.size) {
r
} else {
helper(s ++ List(dr))
}
}
}
helper(Nil)
}
def invert2(inj: (Int => Int) => Int): Int => (Int => Int) = {
def update(f: Int => (Int => Int), n: Int, g: Int => Int): Int => (Int => Int) = {
(a: Int) => if (a == n) g else f(a)
}
def iter(hinv: Int => (Int => Int)): Int => (Int => Int) = {
val f = diag(hinv)
val k = H(f)
if (H(hinv(k)) == k) {
hinv
} else {
iter(update(hinv, k, f))
}
}
iter((n: Int) => zero)
}
def h(ns: Int*) = (f: Int => Int) => ns.map(f).sum
def p2(inj: (Int => Int) => Int) {
val hinv = invert2(inj)
val f = diag(hinv)
val n = H(f)
for (i <- 0 to n) {
val f = hinv(i)
println("%d: %s".format(H(f), (0 to n).map(f).mkString(" ")))
}
println("H(diag) = %d".format(H(f)))
}
def p(inj: (Int => Int) => Int) {
val s = invert(inj)
for (f <- s) {
println("%d: %s".format(H(f), (0 to s.size-1).map(f).mkString(" ")))
}
val hinv = extend(s)
val f = diag(hinv)
println("H(diag) = %d".format(H(f)))
}
def solve(inj: (Int => Int) => Int): (Int => Int, Int => Int, Int) = {
val hinv = extend(invert(inj))
val f = diag(hinv)
val n = H(f)
val g = hinv(n)
(f, g, n)
}
def evalMulti(x: Int, y: Int, coeffs: List[List[Int]]): Int = {
def eval(cs: List[Int]): Int = {
cs match {
case Nil => 0
case h :: t => x * eval(t) + h
}
}
def eval2(cs: List[List[Int]]): Int = {
cs match {
case Nil => 0
case h :: t => y * eval2(t) + eval(h)
}
}
eval2(coeffs)
}
def unevalMulti(x: Int, y: Int, z: Int): List[List[Int]] = {
def uneval(z: Int): List[Int] = {
z match {
case 0 => Nil
case z => (z % x) :: uneval(z / x)
}
}
def uneval2(z: Int): List[List[Int]] = {
z match {
case 0 => Nil
case z => uneval(z % y) :: uneval2(z / y)
}
}
uneval2(z)
}
val rushHour: Distribution[Boolean] = tf(0.2)
val badWeather: Distribution[Boolean] = tf(0.05)
def accident(badWeather: Boolean): Distribution[Boolean] = {
badWeather match {
case true => tf(0.3)
case false => tf(0.1)
}
}
def sirens(accident: Boolean): Distribution[Boolean] = {
accident match {
case true => tf(0.9)
case false => tf(0.2)
}
}
def trafficJam(rushHour: Boolean, badWeather: Boolean, accident: Boolean): Distribution[Boolean] = {
(rushHour, badWeather, accident) match {
case (true, true, _) => tf(0.95)
case (true, _, true) => tf(0.95)
case (_, true, true) => tf(0.95)
case (true, false, false) => tf(0.5)
case (false, true, false) => tf(0.3)
case (false, false, true) => tf(0.6)
case (false, false, false) => tf(0.1)
}
}
case class Traffic(rushHour: Boolean, badWeather: Boolean, accident: Boolean, sirens: Boolean, trafficJam: Boolean)
val traffic = for {
r <- rushHour
w <- badWeather
a <- accident(w)
s <- sirens(a)
t <- trafficJam(r, w, a)
} yield Traffic(r, w, a, s, t)
def partition(xs: List[A]): (List[A], List[A]) = {
xs match {
case Nil => (Nil, Nil)
case h :: t => {
(a, b) = partition(t)
if (h < p) (h :: a, b) else (a, h :: b)
}
}
}
def merge(xs: List[A], ys: List[A]): List[A] = {
(xs, ys) match {
case ...
case (x :: xt, y :: yt) => {
val (a, at, b, bt) = sort2(x, xt, y, yt)
val bs = b :: bt
val abs = merge(at, bs)
a :: abs
}
}
}
def extract(xs: List[A]): (List[A], List[A]) = {
xs match {
case Nil => (Nil, Nil)
case h :: t => {
val (s, r) = extract(t)
s match {
case Nil => (h :: Nil, r)
case sh :: st => {
if (h < sh) (h :: sh :: st, r) else (sh :: st, h :: r)
}
}
}
}
}
def extract(xs: List[A]): (List[A], List[A]) = {
xs match {
case Nil => (Nil, Nil)
case a :: abs => {
val (bs, at) = extract(abs)
bs match {
case ... =>
case b :: bt => {
(x, xt, y, yt) = sort2(a, at, b, bt)
(x :: xt, y :: yt)
}
}
}
}
}
def strand(xs: List[A]): List[A] = {
val (s, r) = extract(xs)
merge(s, strand(r))
}