Example: Find the value of x for which XFX equals 599.5. Use a guess in the vicinity of 1. Start by keying in XFX :

@Å@É x †O3.7

*x Q3 +4.5 * x Q2 +3.9 *x +5 `

Store the program in XFX, then enter the program name, the yvalue 599.5, and the guess 1, and execute

ROOTR:

OX→FX K

OJ %X²FX% `

599.5 ` 1 %ROOTR%

Animating a Graphical Image

Program WALK shows a small person walking across the display. It animates this custom graphical image by incrementing the image position in a loop structure.

Techniques used in WALK

Custom graphical image. (Note that the programmer compiles the full information content of the graphical image before writing the program by building the image interactively in the Graphics environment and then returning it to the command line.)

FOR…STEP (definite loop). WALK uses this loop to animate the graphical image. The ending value for the loop is MAXR. Since the counter value cannot exceed MAXR, the loop executes indefinitely.

WALK program listing

Program:

Comments:

 

«

 

 

GROB 9 15 E300

Puts the graphical image of the

 

140015001C001400E300

walker in the command line.

 

8000C110AA0094009000

(Note that the hexadecimal

 

4100220014102800

portion of the graphics object is

 

 

 

 

a continuous integer

 

 

E300...2800. The

 

 

linebreaks do not represent

 

 

spaces.)

 

→ walk

Creates local variable walk

 

«

containing the graphics object.

 

 

 

ERASE { # 0d # 0d }

Clears PICT, then displays it.

 

PVIEW

 

 

 

RPL Programming Examples 239

Page 119
Image 119
HP 48gII Graphing manual Animating a Graphical Image, @Å@É x †O3.7, X²FX% ` 599.5 ` 1 %ROOTR%, Techniques used in Walk