Edit: Never mind. I apparently had submitted the right answer with commas the first time and every time I got it after I assumed I still had it wrong.
Day 13 Spoilers, Question
So I had a simd/accelerate Doubles based linear system solver on hand, so I used it.
func solveLinearPair(x1:Double, y1:Double, r1:Double, x2:Double, y2:Double, r2:Double) -> SIMD2<Double> {
let a = simd_double2x2(rows: [
simd_double2(x1, y1),
simd_double2(x2, y2)
])
let b = simd_double2(r1, r2)
return simd_mul(a.inverse, b)
}
It got me the answer to part one just fine in combination with an Int initializer that forgives Doubles, to a point. init?(notExactly d:Double, fuzzBy fuzz:Double)
. I just cannot get it to give me the right answer to part two (bring up and down the fuzz factor) I tried rewriting a solver with just ints, and again my Matrix2DInt.Inverse * Vector2DInt gets me the answer to 1 but not 2. I suspect it's a remainder problem? Is there a trick to avoid all the divisions? I feel like I must be forgetting a trick...