This is the solution video to the Unit 3 homework
the intermediate level.
The questions asks us to compose
a fractal using an initial line segment
and then adding 3 more line segments
to it to create this kind of a shape.
So the fractal is very similar to the
Koch curve. It just adds one more
line segment, but it's still dividing
the initial line segment, this one,
into 3 pieces, and then inserting
this additional piece.
So the Hausdorff dimension
for this shape would be log 5 over log 3,
which is 1.46, roughly.
Now let's go to the NetLogo model
and construct it.
So I'm opening up the
Koch Curve NetLogo model,
press Setup, and then Step.
And you can iterate this Koch curve
a number of times.
Now go to the Code button.
Here we are in the Code tab of the program.
Let's scroll down to the "to iterate" procedure
and this is where the Koch curve is inputed.
And we're going to change this
to our new shape,
which is similar so we'll keep some of it
but let's change this 60 to 90.
And then change this right to 90.
And then we need to do all that again.
So I'm going to cut and paste that piece.
And then our final leg
is left 90.
Let's see if that works.
I'm going to check the code
to see if it's ok.
The code looks ok,
so I'm going to go back to the interface
and run the program, press Setup,
and Step, and Iterate a few times.
And it looks like something's wrong.
What's actually happening is that the shape
is going off the view.
It's larger than our view window.
So go to Settings, and we can increase
the Y coordinate of our view size,
maximum PY core.
Let's make that 90.
Press Ok.
And now let's see if it works.
Setup, Step.
I have to scroll down to see
the entire shape.
Iterate a few times.
And it looks like it's correct.
The next step of the homework
will be to define this shape again
in the box-counting program.
And then check its dimension
using box-counting and compare that
to the Hausdorff dimension.
Here I have the Box-Counting Dimension
NetLogo model open.
Press the button labeled Koch curve
and then press the button Iterate.
And we can see our familiar Koch curve shape
iterating a number of times.
This program also allows you to
analyze the box-counting dimension
for an individual shape, which we'll do in
a second, but first let's set up
the Koch curve button to now be our
homework button.
So I'm going to drag the cursor across
the button labeled Koch Curve,
then right click, and go to Edit.
And then we'll change the display name
Koch Curve to HW-3 for Homework 3.
And we also need to change this line
Set fractal example
to be, instead of Koch curve, HW-3.
Make sure you save the parentheses.
HW-3, and then press Ok.
Now we have a button set up for
our homework shape.
So we need to now change that
procedure to be the correct shape.
So go to the Code button,
scroll down to the setup procedure,
And in this line, where it says
"if fractal example=koch-curve"
we'll change the koch-curve to HW-3.
And then scroll down to the Koch curve
procedure, here, and again
we'll change this koch-curve to HW-3.
And we need to reprogram our directions.
So again, this is similar to the first part
of the homework.
We'll turn left 90.
Then here we'll have to turn right 90.
And then we need to do all that again.
So I'm going to cut and paste this section.
Turn right 90 again, this gets back to
the original line segment.
And then at the very end we'll
turn left 90.
And check that.
Go back to the interface.
Press Homework 3, and Iterate.
Now we can see our homework shape iterating.
So I'm going to iterate that 3 times.
Then go down to the Box-Counting Controls
and press Box-Counting Setup button.
And then Box-Counting Go.
And we can see the program
performing a box count of our new shape.
And we'll let that run for a little while
to do it at least a half a dozen iterations or so.
It's running kind of slow
so I'm going to try to speed it up
a little bit.
See if this helps.
And we can see that the Box-Counting Plot
is plotting all the points that each run generates.
So it's counting the number of boxes
and comparing that to the size of each box.
And I'm going to stop that by going to Tools
and scrolling down to Halt.
And then we'll press Find Best Fit Line.
And this is showing us that we're getting
a box-counting dimension of 1.254,
and we can compare that to our
Hausdorff dimension of 1.465
and see that it's relatively accurate,
but not probably as good as we would like.
So we could change our initial box length
and also change our increment
and play with that and see if we can get
a tighter fit for our distribution.
But I'll leave that to you to experiment.
And this is the conclusion of the
Intermediate Homework for Unit 3.