The bitwise exclusive or operator " ∧ " is well-defined for all non-negative integers. We can easily extend it to the non-negative reals. Simply take two non-negative reals, x and y , and write each one out in binary. Line the digits up, and let z = x ∧ y like so:
x = 1 0 1 . 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 . . . y = 1 1 1 . 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 . . . z = 0 1 0 . 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 . . .
It may be the case that x or y have two possible representations in binary, one ending in infinite 0 's, the other in infinite 1 's. For uniqueness and therefore determinism, we choose the representation with infinite 0 's.
Let C be the interior of a circle in R 2 , with radius 2 1 , and center at ( 2 1 , 2 1 ) . Let I as:
I = C ∬ x ∧ y d x d y
What is 2 2 0 I , rounded to the nearest integer?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Hah, well done. My choice of integration domain was not as tricky as it could have been, it seems.
So... hmm. I feel like I should either change the problem to have a domain of integration for which the reflection trick doesn't work, or stick the problem as-is in #Calculus, since no programming is actually required. Thoughts, anyone?
UPDATE: And I see that topic-change is now a user-accessible feature! Thank you Brilliant staff - moved this problem to Calculus.
Yes, this is how I did it as well. Presumably everyone who solves the problem will do it this way (except the proposer :) ).
The function f ( x , y ) = x ∧ y is neither differentiable nor continuous, and has no closed form anti-derivative. Despite all of this, the function is, in fact, integrable.
Before we can make any progress, we need to get some idea of what this function looks like, at least in [ 0 , 1 ] × [ 0 , 1 ] . It's clear that at all such points, x ∧ y is bounded in [ 0 , 1 ), but we need to have some idea of what the distribution is like if we're going to integrate it. Here's a rendering of what the function looks like for each bit, starting with the 1 / 2 bit, then the 1 / 4 bit, and so on. The bluer a pixel is, the closer it is in value, for the acknowledged bits, to 1 , while the whiter pixels are closer to 0 in value.
The rendering should make obvious what we can also derive analytically - that x ∧ y has fractal behavior on the coordinate plane. Each binary bit below 2 0 is set for exactly half of the area of [ 0 , 1 ] × [ 0 , 1 ] , but over increasingly finer-grained checkerboards for each bit. This enables us to answer a useful question:
0 ∫ 1 0 ∫ 1 x ∧ y d x d y = 2 1 ( 2 1 1 + 2 2 1 + 2 3 1 + . . . ) = 2 1
More directly, we can actually compute the integral of any square in any fractal layer, by computing the minimum value of x ∧ y based on the square's coordinates and dimensions, and then using the geometric series we discovered to compute the total value across all remaining bits. However, the domain of integration - a circle - cannot be fully divided into exactly these fractal squares. This is okay, though, because we don't need to compute I exactly - we just need to get it accurate to 2 0 bits.
We can borrow a technique used by cartographers here to get I arbitrarily accurate. We can pick an n ≥ 0 , divide the unit square into 2 n × 2 n sub-squares. For each one, we know how to compute the true integral, V , over that square. We add a value to the total integral volume based on a simple condition for each square
If the square is totally within the circular domain, add V
If the square is partially within, and partially without, add 2 1 V
Otherwise, add 0
To get 2 0 bits of accuracy, we need to ensure that the total volume of the boundary squares in our calculation does not exceed 2 − 2 0 . For a given n , the approximate total volume of the boundary squares is:
2 1 ⋅ π ⋅ ( ( 2 1 ) 2 − ( 2 1 − 2 n 1 ) 2 )
To get this expression below 2 − 2 0 , n needs to be 2 1 or greater. However, we can't evaluate 2 2 1 × 2 2 1 squares directly - it would take days, if not weeks, to do 2 4 2 calculations like that. Fortunately, we don't have to - we can, instead, recursively evaluate the unit square [ 0 , 1 ] × [ 0 , 1 ] , splitting it into four equal quadrants for further evaluation when the square is not strictly within or without the circle. In this way, we will make a number of calculations that is linear in the number of boundary squares, which is linear in 2 n , rendering the calculation tractable. Here's a rendering of the recursive breakdown, where red overlays are outside, green are inside, and yellow are border:
Running the code below up through n = 2 1 (R = 22 in the code) yields the answer 4 1 1 7 7 5 , though the error bounds cross the fractional 0 . 5 mark, so we can't be certain the rounded answer is correct. Running an additional step, with n = 2 2 , gives us tight enough error bounds to be completely confident in the answer, 4 1 1 7 7 5 .
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 |
|
That soultion... like a boss.
Awesome idea and nice animations. Can you share the code for your animations?
Problem Loading...
Note Loading...
Set Loading...
It is easy to show that if 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1 , then x ∧ y + x ∧ ( 1 − y ) = 1 .
Let I = ∬ C x ∧ y d x d y . Using the transformation y ↦ 1 − y , we get I = ∬ C x ∧ ( 1 − y ) d x d y . Then 2 I = ∬ C x ∧ y d x d y + ∬ C x ∧ ( 1 − y ) d x d y = ∬ C ( x ∧ y + x ∧ ( 1 − y ) ) d x d y = ∬ C 1 d x d y = 4 π , so I = π / 8 .
The closest integer to 2 2 0 ⋅ π / 8 is 411775.