LOGO-L> fractal
Author Message
LOGO-L> fractal

Quote:
>snowflake.  He has constructed equilateral triangles and made both by hand.
>Now he is using logowriter and writing a program to draw them.  He has been
>successful, but the programs are very long.  He is looking for repeated
>commands in order to consolidate his program.

You can get Koch's snowflake with procedures

to S.Flake :st :dl
rt 30
repeat 3 [bok :st :dl rt 120]
end

to bok :st :dl
if :st=0 [fd :dl stop]
bok :st-1 :dl/3
lt 60
bok :st-1 :dl/3
rt 120
bok :st-1 :dl/3
lt 60
bok :st-1 :dl/3
end

I hope, they are simple enough. Try with S.Flake 0 50    S.Flake 2 60 etc

I don't remember "Sierpinski triangle", but so called "Sierpinski's carpet"
may be
described as follow:

to S2.frac :st :b
rt 45
repeat 4 [fd :b rt 90 S2.lacz :st :b rt 90]
end

to S2.lacz :st :b
if :st=0 [lt 90 stop]
S2.lacz :st-1 :b
rt 90 fd :b rt 90
S2.lacz :st-1 :b
lt 45 fd :b lt 45
S2.lacz :st-1 :b
rt 90 fd :b rt 90
S2.lacz :st-1 :b
end

You may try with S2.frac 2 10    S2.frac 3 10

Please forgive polish names: "lacz" = "connection", "bok"="edge". Sierpinski
was Pole however.

Quote:
>Question is - I remember that the Sierpinski could be drawn with a very
>brief program, but have no idea how to go about it.  Can anyone give us a
>hint?  Of course I would love a program to copy, but even better would be
>some suggestions of what to look up or try out so we can maybe figure it
>out.  Does it involve using :something?  I hate admitting ignorance here,
>but honesty is, well, you know!

Both figures may be called self-remaining. Less complex figure is the
element of more complex.

These are next 2 examples - extremely simple:

"Hyper-tee" - it's like character "T"

to te :k :dl
if :k=0 [fd :dl back :dl stop]
fd :dl
lt 90
te :k-1 0.7*:dl
lt 180
te :k-1 0.7*:dl
lt 90
back :dl
end

Try with   te 3 30  or te 4 40

"Leopolis castle"

to baszta :k :wys
if :k=0 [lt 180 stop]
fd :wys
baszta :k-1 :wys
left 90
fd :wys
left 90
baszta :k-1 :wys
fd :wys
end

Try with baszta 3 20  or baszta 4 20

Andrzej Baczynski

Lodz, POLAND
Andrzej B.

---------------------------------------------------------------

Mon, 09 Aug 1999 03:00:00 GMT
LOGO-L> fractal

Thank you, Andrzej, for those marvelous fractal routines. Have you any
others? The 'te' procedure reminded me of one I wrote which I'd like to share...

to branch :s :b :n :z
if :n=0 [stop]
; :S is stem length
; :B is number of branches
; :n is number of levels
; :z is heading when this procedure is called
repeat :b [rt (random 120)-60 fd :s branch :s/2 :b :n-1 heading bk :s]
end

to mainstem :size
make "s2 :size/(1+random 4)
rt (random 30)-15 fd :size ;rt (random 30)-15 fd (:size-:s2)
end

to plant
ht
pu home bk 100 lt 90 fd (random 100)-50 rt 90 pd
make "stem 50+random 50
make "si 10 + random 50
make "br 4+random 3
make "lev 3+random 2
end

Just type 'plant' to draw something which looks like wildflowers.

Tom

---------------------------------------------------------------

Mon, 09 Aug 1999 03:00:00 GMT
LOGO-L> fractal

Here's a very different way to generate the Sierpinski triangle.
Create four turtles. Put turtles t2, t3, t4 at the vertices of the
desired triangle. Then run this procedure (written in MicroWorlds
syntax):

to go
let [target pick [t2 t3 t4]]
t1, towards :target
fd 0.5 * distance :target
pd fd 0 pu
go
end

Also: Try experimenting with values other than 0.5

-- Mitchel Resnick
---------------------------------------------------------------

Tue, 10 Aug 1999 03:00:00 GMT
LOGO-L> fractal

Quote:
>Here's a very different way to generate the Sierpinski triangle.
>Create four turtles. Put turtles t2, t3, t4 at the vertices of the
>desired triangle. Then run this procedure (written in MicroWorlds
>syntax):

>to go
>let [target pick [t2 t3 t4]]
>t1, towards :target
>fd 0.5 * distance :target
>pd fd 0 pu
>go
>end

But is that the Sierpinski triangle or just something that looks exactly
like it? (Is this discussion is getting a bit chaotic?)

--------------------------------------------------------
Michael Tempel                    tel: 212 579 8028
Logo Foundation                   fax: 212 579 8013

New York  NY 10024
http://el.www.media.mit.edu/groups/logo-foundation/

---------------------------------------------------------------

Tue, 10 Aug 1999 03:00:00 GMT
LOGO-L> fractal

Here's a very different way to generate the Sierpinski triangle.
Create four turtles. Put turtles t2, t3, t4 at the vertices of the
desired triangle. Then run this procedure (written in MicroWorlds
syntax):

to go
let [target pick [t2 t3 t4]]
t1, towards :target
fd 0.5 * distance :target
pd fd 0 pu
go
end

Also: Try experimenting with values other than 0.5

-- Mitchel Resnick

---------------------------------------------------------------

Tue, 10 Aug 1999 03:00:00 GMT
LOGO-L> fractal

Hello!
I'd like to do two things in the frame of fractal discussion - to add
one more routine to our collection and to "add some oil to the flame"
of the discussion.
The first part is a simple one. Here is a Mandelbrot Snowflake.

to mandelbrot.flake.main :length :level
cs ht
repeat 4[mandelbrot.flake.step :length :level rt 90]
end

to mandelbrot.flake.step :length :level
if :level<0 [fd :length stop]
mandelbrot.flake.step :length/4 :level-1 lt 90
mandelbrot.flake.step :length/4 :level-1 rt 90
mandelbrot.flake.step :length/4 :level-1 rt 90
mandelbrot.flake.step :length/4 :level-1
mandelbrot.flake.step :length/4 :level-1 lt 90
mandelbrot.flake.step :length/4 :level-1 lt 90
mandelbrot.flake.step :length/4 :level-1 rt 90
mandelbrot.flake.step :length/4 :level-1
end

The second part is a little more difficult, for I'm not sure in my
English. But, I think, there are a lot of clever heads there to
clarify the things I'd like to share, if they are worth discussing.

I'd like to draw your attention from the perfect beauty of the
fractals to some important mathematical questions arisen there.
Let's take for example Koch Snowflake. Can you estimate a perimeter of
the first order curve and the square inside it? Sure! And what about
second order curve? Rather simple calculations. And the third order
curve? And if we go to the infinity?  And if one goes to the infinity
and accurately makes estimations there, he'd find out that the
perimeter of the Snowflake "is equal" to infinity, but the square is
just 8/5 of initial one.
The same investigations may be done with Sierpinski Triangle. The
children may even cut the triangles of the white and black pieces of
paper and... go to the infinity.

May be, I've missed it, but I didn't see this example in the fractal
discussion. The following codes are from J. Muller wonderful book.

to dragon :size :level
ldragon :size :level
end

to ldragon :size :level
if :level=0 [fd :size stop]
ldragon :size :level-1 lt 90
rdragon :size :level-1
end

to rdragon :size :level
if :level=0 [fd :size stop]
ldragon :size :level-1 rt 90
rdragon :size :level-1
end

It might be interesting to investigate with the children this curves
with the help of the strip of paper.
Take the strip of paper and fold it several times, putting every time
the left edge on to the right one. Then unfold the strip. There will
be folds of different kind - "hills" (H) and "gaps" (G)
How many folds will be there?  S(n)=2* S(n-1)+1, S(0)=0.
In the middle there always be - G
What about the folds to the left and to the right of the middle?
They are of opposite kind, that is, first to the right - H, first to
the left - G, second to the right - G, second to the left - H and so
on.
For example, after 3 foldings: H H G G H G G
after 4 - H H G H H G G   G   H H G G H G G
One more remarkable quality:
after every  new folding the right side of the new strip repeats the
hole previous one.

All this things can be easily explained and understood.
Now, change G for lt 90, H to rt 90 and you'll have the Dragon curve.

I've talked a lot today! :-> Thanks to all!
Hope, something from all this may be useful.

Olga Tuzova.

-------------------------------------------------

Olga Tuzova, Ph.D.
Computer Science teacher,
International School of General Education,
St.Petersburg, Russia,

URL http:\\www.ort.spb.ru
---------------------------------------------------------------

Fri, 13 Aug 1999 03:00:00 GMT

 Page 1 of 1 [ 6 post ]

Relevant Pages