Operation Manual
14-8 Applications
8214APPS.DOC TI-82, Chapter 14, English Bob Fedorisko Revised: 02/09/01 9:27 AM Printed:
02/09/01 12:43 PM Page 8 of 20
Program: Sierpinski Triangle
This program creates a drawing of a famous fractal, the Sierpinski Triangle, and
stores the drawing in a picture.
Program
PROGRAM:SIERPINS
:FnOff :ClrDraw
:PlotsOff
:AxesOff
:0
!
Xmin:1
!
Xmax
:0
!
Ymin:1
!
Ymax
Set viewing
WINDOW
:rand
!
X:rand
!
Y
:For(K,1,3000)
:rand
!
N
Beginning of
For
group
:If N
1
à
3
:Then
:.5X
!
X
:.5Y
!
Y
:End
If
/
Then
group
:If 1
à
3<N and N
2
à
3
:Then
:.5(.5+X)
!
X
:.5(1+Y)
!
Y
:End
If
/
Then
group
:If 2
à
3<N
:Then
:.5(1+X)
!
X
:.5Y
!
Y
:End
If
/
Then
group
:Pt-On(X,Y)
Draw point
:End
:StorePic Pic6
End of
For
group
Note: After executing this program, you can recall and display the picture
with the instruction
RecallPic Pic6
.