Program: Sierpinski Triangle - TI -82 Manual Book

Graphing calculator
Table of Contents

Advertisement

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
!
:0
Ymin:1
!
:rand
X:rand
:For(K,1,3000)
!
:rand
N
:If N1à3
:Then
!
:.5X
X
!
:.5Y
Y
:End
:If 1à3<N and N
2à3
:Then
:.5(.5+X)
!
:.5(1+Y)
:End
:If 2à3<N
:Then
!
:.5(1+X)
!
:.5Y
Y
:End
:Pt-On(X,Y)
:End
:StorePic Pic6
Note: After executing this program, you can recall and display the picture
with the instruction
14-8 Applications
!
Xmax
!
Ymax
!
Y
!
X
Y
X
RecallPic Pic6
Set viewing
WINDOW
Beginning of
For
group
If
/
Then
group
If
/
Then
group
If
/
Then
group
Draw point
End of
For
group
.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents