beautypg.com

Random walks – Sharp EL-9900 User Manual

Page 47

background image

10

Basic 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 a random walk. A random walk can go in

any direction for a random distance. This program stops when the graph

tries to go outside the calculator display.

2.

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

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

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

3.

Enter the following program using the Advanced Keyboard:

ClrDraw

2ndF

DRAW

A

1 ENTER

0

⇒D

0

STO

ALPHA D ENTER

.5

⇒X

.

5

STO X/

θ/T/n ENTER

.5

⇒Y

.

5 STO

ALPHA Y ENTER

Label A

PRGM B 0 1 ALPHA A

ENTER

.2(random–.5)

⇒H

. 2 (

MATH C 1 – . 5 )

STO

ALPHA H

ENTER

.2(random–.5)

⇒K

. 2 (

MATH

C 1 – . 5 )

STO

ALPHA K ENTER

Line(X,Y,X+H,

2ndF DRAW A 2 X/

θ/T/n , ALPHA

Y+K)

Y

, X/

θ/T/n + ALPHA H , ALPHA

Y + ALPHA K )

ENTER

X+H

⇒X

X/

θ/T/n + ALPHA H STO X/θ/T/n ENTER

Y+K

⇒Y

ALPHA Y + ALPHA K

STO ALPHA

Y ENTER

If X<0 Goto B

PRGM B 0 3 X/

θ/T/n MATH F

5

0 PRGM B

0 2 ALPHA B ENTER

If X>1 Goto B

PRGM B

0 3 X/

θ/T/n MATH F 3 1

PRGM B 0 2 ALPHA B

ENTER

If Y<0 Goto B

PRGM B 0

3 ALPHA Y MATH

F 5 0

PRGM

B 0 2

ALPHA B ENTER

RANDOM WALKS