Skip to content

Instantly share code, notes, and snippets.

View tom-huntington's full-sized avatar

tom-huntington

View GitHub Profile

Let $p,v,t$ be the position, velocity and time unknowns such that for all $i$ we have a collision

$$p-p_i - t\times(v-v_i)=0.$$

To eliminate $t$ we wedge (exterior) product with $v-v_i$ to get

$$0=(p-p_i)\wedge (v-v_i)= p\wedge v - p \wedge v_i - p_i \wedge v + p_i \wedge v_i.$$

The nonlinear term $p\wedge v$ is constant for all $i$, so we subtract equations to get a linear equation

@tom-huntington
tom-huntington / python_notes.md
Last active December 25, 2023 01:54
Notes on 4HbQ's aoc solutions

complex for 2 vectors

Arithmatic operations broadcast unlike tuples

>>> complex(1,1) + complex(2,-2)
(3-1j)

Associative array :: T -> int

Use index/find on list or string

Knowing when you don't need correctness is very expensive for developer productivity.

Skipping corners, not verifying correctness is necessary for productivity. There are multiple levels of correctness. Rubbish > Does Something > Reasonable > Justified > Correct > Omniscient optimal. The level of correctness needs to be observable.

Only Program what is minimally sufficient

Most of the time you programme more specific results than you actually need. Don't do this

Programming is an empirical discipline

Writing correct code the first time is economically unviable.

@jameslyons
jameslyons / levinson.jl
Last active October 26, 2023 02:59
Levinson durbin recursion for LPC calculation
function levinson(R,L)
a = zeros(L,L)
P = zeros(1,L)
# for m = 1
a[1,1] = -R[2]/R[1]
P[1] = R[1]*(1-a[1,1]^2)
# for m = 2,3,4,..L
for m = 2:L