beautypg.com

The sierpinski triangle – Sharp EL-9900 User Manual

Page 142

background image

9

Advanced Keyboard/PROGRAMMING USING THE SHARP EL-9900

Copyright © 2002, Sharp Electronics Corporation. Permission is granted to photocopy for educational use only.

1.

Program the calculator to graph the Sierpinski triangle, which is an infinite

set of nested equilateral triangles. The graph is generated from a

construction of a fractal by means of an iterated system, or in other words,

playing a chaos game.

2.

Create a new program with the name SIERPINS. Enter the following program

and remember to press ENTER at the end of each line. If you make a mis

take, use the calculator’s editing features to correct the error.

3.

Enter the following program:

random

⇒X

MATH C 1 STO X/

θ/T/n ENTER

random

⇒Y

MATH C 1 STO ALPHA Y ENTER

1

⇒I

1

STO ALPHA I ENTER

Label A

PRGM B 0 1 ALPHA A ENTER

random

⇒N

MATH C 1 STO

ALPHA N ENTER

If N>(1

÷3) Goto B

PRGM B

0 3 ALPHA N MATH

F 3 (

1

÷

3 )

PRGM B 0

2 ALPHA B ENTER

.5(X+1)

⇒X

. 5 (

X/

θ/T/n + 1 ) STO X/θ/T/n

ENTER

.5Y

⇒Y

.

5 ALPHA Y STO ALPHA Y

ENTER

Goto D

PRGM B 0 2 ALPHA D ENTER

Label B

PRGM B 0 1 ALPHA B ENTER

If N

≤(2÷3) Goto C

PRGM B 0 3 ALPHA N MATH

F 6 (

2

÷ 3 )

PRGM B 0

2 ALPHA C ENTER

.5(X+.5)

⇒X

. 5 (

X/

θ/T/n + . 5 )

STO

X/

θ/T/n ENTER

.5(Y+1)

⇒Y

. 5 (

ALPHA Y + 1 )

STO

ALPHA Y ENTER

Goto D

PRGM

B 0 2 ALPHA D ENTER

Label C

PRGM

B 0 1 ALPHA

C ENTER

THE SIERPINSKI TRIANGLE