Texas Instruments TI-83 Calculator User Manual


 
Applications 17-7
8317APPS.DOC TI-83 international English Bob Fedorisko Revised: 02/19/01 1:00 PM Printed: 02/19/01 1:39 PM
Page 7 of 20
This program creates a drawing of a famous fractal, the
Sierpinski Triangle, and stores the drawing to a picture. To
begin, press
~
~
1. Name the program SIERPINS,
and then press
Í
. The program editor is displayed.
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
End of For group.
:StorePic 6
Store picture.
After you execute the program above, you can recall and
display the picture with the instruction
RecallPic 6.
Using a Program to Create the Sierpinski Triangle
Setting up the
Program
Program