HP 15C Instrukcja Użytkownika Strona 102

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 288
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 101
102 Section 9: Subroutines
Subroutine Limits
A subroutine can call up another subroutine, and that subroutine can call up
yet another subrout   the execution of a
subroutine within a subroutineis limited to stack of subroutines seven
levels deep (this does not count the main program level). The operation of
nested subroutines is as shown below:
Main Program
bA
b1
b2
b3
b4
G1
G3
G2
G4
n
n
n
n
n
End
Examples
Example: Write a program to
calculate the slope of the secant line
joining points (x
1
, y
1
) and (x
2
, y
2
) on
the graph shown, where y = x
2
- sin x
(given x in radians).
The secant slope is:
12
1
2
12
2
2
12
12
)sin ()sin (
or ,
xx
xxxx
xx
yy
The solution requires that the equation for y be evaluated twiceonce for y
1
and once for y
2
, given the data input for x
1
and x
2
. Since the same
calculation must be made for different values, it will save program space to
call a subroutine to calculate y.
The following program assumes that x
1
has been entered into the Y-register
and x
2
into the X-register.
Przeglądanie stron 101
1 2 ... 97 98 99 100 101 102 103 104 105 106 107 ... 287 288

Komentarze do niniejszej Instrukcji

Brak uwag