Problem 1

Question

Let and be bounded subsets of . Let be the set of points such that and . Show that .

box counting dim of set :

for , a grid box in is . a point lands in iff and independently.

so intersects iff the -interval hits and the -interval hits . these are independent conditions, so:

takign logs:

divide by and take :

Answer

via independence of coord conditions. logs turn product into a sum, then passes through the limit.


Problem 2

Question

For the following questions, remember that an answer of true must be proven, while an answer of false must be supported by a counterexample.

(a) True or false: The box-counting dimension of a finite union of sets is the maximum of the box-counting dimension of the sets. Justify your answer.

(b) True or false: The box-counting dimension of a countable (but not finite) union of sets is the maximum of the box-counting dimension of the sets. Assume that the union is bounded.

A

let . for any :

taking logs and sandwhiching:

divide by and send . the term vanishes since is constant, so both bounds collapse to .

Answer

true. for finite unions, . the constant disappears in the limit, so .

B

false. take , which is a countable union of singletons:

each singleton has , so the max dimension is . but is dense in , so every box of any size contains a rational. you need boxes to cover , giving:

Answer

false. is a countable union of points (all dim 0) but has bcd by density. the infinite union can fill the space even if each piece is trivial.


Problem 3

Question

Consider the Cantor set formed by deleting the middle subinterval of length from each remaining interval at step .

(a) Prove that the length of is . Thus is a fat fractal.

(b) What is the box-counting dimension of ?

(c) Let be the function on which is equal to on and elsewhere. It is the limit of functions which are Riemann integrable. Note that is not Riemann integrable. What is the value of any lower Riemann sum for ? (The lower sum is the sum of box areas using the infimum of in each subinterval .)

A

start with . at step , there are intervals, and we remove a middle piece of length from each. total length removed:

so the remaining measure is .

Answer

total removed , so . positive measure but nowhere dense. fat fractal.

B

let be the length of each surviving interval at step , and be the total remaining length. since :

set . need intervals. so:

Answer

. makes sense. any set with positive Lebesgue measure has bcd .

C

nowhere dense, thus complement is dense in . every subinterval of any partition contains points not in , where . thus:

Answer

every lower Riemann sum is . nowhere density of forces a zero in every subinterval.


Problem 4

Question

(a) Find the box-counting dimension of the invariant set of the skinny baker map.

(b) Describe 3-dimensional versions of the attractors in Figures 4.3, 4.4, and 4.5.

(c) Compute the dimension of these versions from part (b).

Hints: In Figure 4.3 there are a couple of ways of extending the example that you might choose. For 4.4, use a tetrahedron (triangular base) rather than a square based pyramid. The second iterate results in 4 tetrahedrons with side length 1/2 of the original. Be sure to manipulate the logarithms until you have integers plus fractional dimensions.

A

figure 4.3: skinny baker map expands vertically by and contracts horizontally by . top half maps to the right vertical strip, bottom to the left. in , the surviving set is exactly a Cantor Set construction (keeping two thirds at each step). in , the expansion and wrapping fills .

using the product formula from problem 1:

Answer

dimension is .

B

fig 4.3 (3d skinny baker): extend to a unit cube by expanding in and and contracting in . invariant set is . sort of a cantor set of sheets.

fig 4.4 (seirpinski tetrahadron): start with a solid tetrahedron. subdivide into 8 smaller tetrahedra of side . keep only the 4 corner tetrahedra, remove the rest.

fig 4.5 (menger sponge): divide a cube into sub-cubes of side . remove center cube and 6 face-adjacent cubes (cross thing). keep sub cubes. repeat.

C

3d skinny baker: , so by problem 1:

sierpinski: pieces, scaling :

menger: pieces, scaling :

Answer

3D baker: . sierpinski tetrahedron: . menger sponge: .


Problem 5

Question

The Koch curve is constructed by taking a line segment and replacing it with four segments, each with length equal to of the original. The result is demonstrated for several iterates by the code koch.m (press return to iterate). Download from Teams. Do the same for sierpinski.m and fern.m. These m-files also require boxcount.m to display the approximate box counting dimension.

(a) What is the box counting dimension of the Koch curve and Sierpinski’s gasket if you compute it by hand? Why do these numbers disagree with what boxcount.m shows you?

(b) What is the length of the Koch curve?

(c) How is the Sierpinski gasket generated?

Please turn in the three figures (koch, sierpinski, fern), both fractals and the dimension plot, with your answers to the above questions.

A

  • koch curve:, n = 4 r = 1/3

\text{bcd} = \frac{\ln 4}{\ln 3} \approx 1.2619

\text{bcd} = \frac{\ln 3}{\ln 2} \approx 1.5850

python equivalent of `boxcount.m` yields $1.328$ for kooh and $1.594$ for sierpinski. code estimates the limit $\epsilon \to 0$ via least squares fit for finite box sizes, but fractals only generated to finite iteration. for small $\epsilon$, count levels off as you have exhausted resolution of set, which tilts slope of the log/log fit. ### B at iteration $k$, total length is $(4/3)^k$. so:

\lim_{k \to \infty} \left(\frac{4}{3}\right)^k = \infty

> [!Success] Answer > > the koch curve has infinite length. ### C `sierpinski.m` uses the chaos game (IFS with probabilities): 1. fix three vertices $A, B, C$ of an equilateral triangle 2. pick a random starting point 3. at each step, pick a random vertex with prob $1/3$ each 4. move halfway to that vertex 5. after enough iterations the points trace out the gasket ### Figures ![[koch.png]] ![[sierpinski.png]] ![[fern.png]] ### Code running matlab is a pain as always, so I used gemini to translate into python and then modified from there. ```python import numpy as np import matplotlib.pyplot as plt def boxcount(coordmat, maxstep, ax=None): glob_llx = np.min(coordmat[:, 0]) glob_lly = np.min(coordmat[:, 1]) glob_urx = np.max(coordmat[:, 0]) glob_ury = np.max(coordmat[:, 1]) epsilon = 1e-8 glob_llx -= epsilon glob_lly -= epsilon glob_urx += epsilon glob_ury += epsilon x_vals = [] y_vals = [] for step in range(maxstep + 1): n_sds = 2**step H, _, _ = np.histogram2d(coordmat[:, 0], coordmat[:, 1], bins=(n_sds, n_sds), range=[[glob_llx, glob_urx], [glob_lly, glob_ury]]) n_boxes = np.sum(H > 0) x_vals.append(step * np.log(2)) y_vals.append(np.log(n_boxes) if n_boxes > 0 else 0) x_vals = np.array(x_vals) y_vals = np.array(y_vals) A = np.vstack([x_vals, np.ones(len(x_vals))]).T param, _, _, _ = np.linalg.lstsq(A, y_vals, rcond=None) frac_dim = param[0] if ax is not None: ax.plot(x_vals, y_vals, 'o') ax.plot([x_vals[0], x_vals[-1]], [param[0]*x_vals[0] + param[1], param[0]*x_vals[-1] + param[1]], '-') ax.set_title(f'Estimated fractal dimension = {frac_dim:.6f}') ax.set_xlabel('n*ln(2)') ax.set_ylabel('ln(n_boxes)') return frac_dim # Koch k = 6 mmax = 4**k x = np.zeros(mmax + 1) y = np.zeros(mmax + 1) h = 3**(-k) angle = [0, np.pi/3, -np.pi/3, 0] for a in range(1, mmax + 1): m = a - 1 ang = 0 for b in range(1, k + 1): segment = m % 4 m = m // 4 ang += angle[segment] x[a] = x[a-1] + h * np.cos(ang) y[a] = y[a-1] + h * np.sin(ang) fig, axes = plt.subplots(1, 2, figsize=(12, 5)) axes[0].plot(x, y, 'b') axes[0].set_aspect('equal') axes[0].set_title('Koch Curve') coordmat = np.column_stack((x, y)) frac_dim = boxcount(coordmat, 9, ax=axes[1]) plt.savefig('koch.png', dpi=300) plt.close() # Sierpinski Nmax = 50000 A = np.array([0, 0]) B = np.array([4, 0]) C = np.array([2, 2*np.sqrt(3)]) P = np.zeros((Nmax + 1, 2)) scale = 0.5 for n in range(Nmax): r = np.random.rand() if r < 1/3: P[n+1] = P[n] + (A - P[n]) * scale elif r < 2/3: P[n+1] = P[n] + (B - P[n]) * scale else: P[n+1] = P[n] + (C - P[n]) * scale fig, axes = plt.subplots(1, 2, figsize=(12, 5)) axes[0].plot(P[:, 0], P[:, 1], '.', markersize=1) axes[0].set_xlim(0, 4) axes[0].set_ylim(0, 2*np.sqrt(3)) axes[0].set_aspect('equal') axes[0].set_title('Sierpinski Triangle') frac_dim = boxcount(P, 9, ax=axes[1]) plt.savefig('sierpinski.png', dpi=300) plt.close() # Fern N = 50000 P = np.zeros((N, 2)) P[0] = [0.5, 0.5] def T(P, a, b, c, d, e, f): return np.array([a*P[0] + b*P[1] + c, d*P[0] + e*P[1] + f]) for k in range(N - 1): r = np.random.rand() if r < 0.05: P[k+1] = T(P[k], 0, 0, 0, 0, 0.2, 0) elif r < 0.86: P[k+1] = T(P[k], 0.85, 0.05, 0, -0.04, 0.85, 1.6) elif r < 0.93: P[k+1] = T(P[k], 0.2, -0.26, 0, 0.23, 0.22, 1.6) else: P[k+1] = T(P[k], -0.15, 0.28, 0, 0.26, 0.24, 0.44) fig, axes = plt.subplots(1, 2, figsize=(12, 5)) axes[0].plot(P[:, 0], P[:, 1], '.', markersize=1) axes[0].set_xlim(-2.5, 3.5) axes[0].set_ylim(0, 11) axes[0].set_title('Barnsley Fern') frac_dim = boxcount(P, 9, ax=axes[1]) plt.savefig('fern.png', dpi=300) plt.close() ```