Skip to content

Instantly share code, notes, and snippets.

View chrismilson's full-sized avatar

Chris Milson-Tokunaga chrismilson

  • In Transit
View GitHub Profile
@chrismilson
chrismilson / time-to-splat.md
Created April 24, 2023 23:04
How much longer does it take to fall double the distance?

Time to fall double distance

$a' = 0$

$v' = a$, $v_0 = 0$, so $v(t) = at$

$d' = v$, $d_0 = 0$, so $d(t) = \frac{at^2}{2}$

rearrange $t$ to subject: $t(d) = \sqrt\frac{2d}{a}$

@chrismilson
chrismilson / knight-vs-bishop.ipynb
Last active February 14, 2023 02:40
Shortest path for knight while avoiding bishop
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrismilson
chrismilson / generous_bookie.ipynb
Last active February 27, 2024 06:22
The Generous Bookie
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrismilson
chrismilson / idzorek-allocation.ipynb
Created April 20, 2021 05:26
An implementation of Idzorek's approach to the Black-Litterman allocation model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrismilson
chrismilson / matrix_fibonacci.ipynb
Last active April 14, 2021 02:53
A matrix based way to calculate recurrence relations.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrismilson
chrismilson / number-game.ipynb
Last active April 8, 2021 05:04
Number Game
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chrismilson
chrismilson / Tuple.d.ts
Last active January 22, 2021 05:58
Typescript Tuple Definition
/**
* Constructs tuples of `never` of length 2^K for all 0 ≤ K and 2^(K - 1) ≤ N.
* The tuples are in decreasing order by their lengths.
*
* The placeholder type `never` is chosen because it lets us test the length, as
* opposed to a generic type, which may be extended by undefined, and give us
* unexpected results.
*
* This type should not be used directly; it is a support type for Tuple.
*
@chrismilson
chrismilson / python-zip.ts
Last active October 12, 2022 10:03
A python-like zip iterator in typescript
export type Iterableify<T> = { [K in keyof T]: Iterable<T[K]> }
/**
* Iterates over multiple iterable objects in parallel.
*
* Stops iteration when any of the iterators is done.
*/
export function* zip<T extends Array<any>>(
...toZip: Iterableify<T>
): Generator<T> {
@chrismilson
chrismilson / the-challenge.md
Created November 29, 2020 07:23
MPMP19 - The 19 Challenge

This is the ninteenth puzzle in Matt Parker's Matt Parker's Maths Puzzles puzzle series

The 19 Challenge

If you sum of the squares of the first 19 primes you get a multiple of 19.

Find another number n that has the property that the sum of the squares of the first n primes is a multiple of n.

Solution

@chrismilson
chrismilson / car-and-diamond.md
Last active November 12, 2020 06:48
MPMP18(JGJG1) - The Car and the Diamond

This is the eighteenth puzzle in Matt Parker's Matt Parker's Maths Puzzles puzzle series

The Car and the Diamond

A contestant is on a game show with five different prizes:

  • A car;
  • A diamond;
  • A goat;
  • A jar of bogeys; and,