EasyManua.ls Logo

HP HP-28S - Page 248

HP HP-28S
341 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
FIB1 (Fibonacci Numbers, Recursive Version)
Arguments
Results
1:
n
Techniques:
IFTE
(1£-
Then-Else function).
The
defining
expression for FIBI
con-
tains
the
conditional
function
IFTE,
which
can
be
used
in
either
RPN
or
algebraic syntax. (FIB2 uses
the
program
structure
IF
.,.
THEN
...
ELSE
...
END.)
Recursion.
The
defining
expression for
FIB1
is
written
in
terms
of
FIB!,
just
as
Fn
is
defined
in
terms
of
Fn
_ 1
and
Fn
-
2'
Program
IFTE(n,fl,
n
..
FI81(n-l)+FI81(n-2»
::;:.
I ENTER I
c:J
FIB1 I
8TO
I
Comments
Begin
the
program.
Define a local variable.
Begin
the
defining
expression.
Ifn~!'
Then
Fn
= n;
Else
Fn
=
Fn
- 1 +
Fll
-
2'
End
the
defining
expression.
End
the
program.
Put
the
program
on
the
stack.
Store
the
program
as
FIB
1.
Example. Calculate
F6
using
RPN
syntax
and
FlO
using
algebraic
syntax.
First calculate
F6
using
RPN.
16US~:~'
ILDD9lI
___
..:1
Next calculate
FlO
using
algebraic syntax.
c:J
FIB
1
IT]
10
I
EVAL
I
.-::13,.....------------,1
~lIilIIIIuma
__
..i!
28:
Programming
Examples
247

Table of Contents

Other manuals for HP HP-28S

Related product manuals