4 ms·
It's just pattern matching. How is this pattern formally defined (for the first problem)? x = sqrt(x + sqrt(x+sqrt(x...))) is informal, so the real definition i
by imh 10y ago
It's just pattern matching. How is this pattern formally defined (for the first problem)? x = sqrt(x + sqrt(x+sqrt(x...))) is informal, so the real definition is a recursion x = sqrt(x + THING), and THING = sqrt(x + THING), which is convenient, because that's just x again. So x = sqrt(x + x) = sqrt(2*x). Oftentimes with mathy stuff (but not always), if you have trouble, right out definitions for the confusing parts and work with that instead, recursing until it makes sense.