Fib2 (Fibonacci Numbers, Loop Version) - HP 48gII Advanced User's Reference Manual

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

Techniques used in FIB1
IFTE (if -then-else function). The defining procedure for FIB1 contains the conditional function IFTE,
!
which can take its argument either from the stack or in algebraic syntax.
Recursion. The defining procedure for FIB1 is written in terms of FIB1, just as F
!
and F
.
n-2
FIB1 program listing
Program:
«
 n
'IFTE(n‰1,
'
»
Checksum: # 14909d (press O%FIB1% !°#MEM# %BYTES%)
Bytes:
113.5
Example: Calculate F
6
First calculate F
.
6
J
6 %FIB1%
Next, calculate F
using algebraic syntax.
10
O%FIB1% !Ü10 N

FIB2 (Fibonacci Numbers, Loop Version)

Techniques used in FIB2
IF...THEN...ELSE...END. FIB2 uses the program-structure form of the conditional. (FIB1 uses IFTE.)
!
START...NEXT (definite loop). To calculate F
!
successive values of F
i
2-2 RPL Programming Examples
n,
FIB1(n-1)+FIB1(n-2))
`OFIB1 K
. Calculate F
using algebraic syntax.
10
Level 1
n
.
Comments:
Defines local variable n.
The defining procedure, an
algebraic expression. If n
1, F
= n, else F
n
n
Stores the program in FIB1.
"
Level 1
"
F
n
, FIB2 starts with F
and F
n
0
is defined in terms of F
n
= F
+F
.
n-1
n-2
and repeats a loop to calculate
1
n-1

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents