HP 30b HP 20b Business Consultant and HP 30b Business Professional User's Guid - Page 85

Programming Example, The Mode, Menu: Setting Preferences, Basic Features - equations

Page 85 highlights

Programming Example The following programming example, and all examples in this chapter, were written with Chain or Algebraic set as the operating mode. Since a program executes the keys exactly as if you were manually pressing them, the current operating mode affects how the program executes. If you normally operate in RPN, verify your operating mode is set to either Chain or Algebraic before proceeding so you can follow along with the examples below. For more information about setting the operating mode, refer to the section titled, The Mode Menu: Setting Preferences in Chapter 1, Basic Features. The volume of a sphere is represented by the equation, 43--πr3 . We will create a program that can calculate the volume of a sphere without having to retype all the keys each time you wish to calculate the volume of a given sphere. Verify your FIX setting is set for three digits to the right of the decimal point. For more information on the FIX setting, refer to the section titled, The Mode Menu: Setting Preferences in Chapter 1, Basic Features. Table 13-2 Keys :E Display Description Enters program mode. The first program is selected. I :h3* 4/3* :sI I= :(HOLD) Starts editing program 0. Note the counter shows your current position in the program. We have entered a program that takes the currently displayed number, raises it to the 3rd power, and multiplies it by 4/3 of PI. The STOP instruction tells the calculator that the program is ending. Note that to enter that special instruction, you need to press and hold the shift key, then press the L key (STOP) before releasing both keys. Programming 77

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114

Programming
77
Programming Example
The following programming example, and all examples in this chapter, were written with
Chain
or
Algebraic
set as the operating mode. Since a program executes the keys exactly as
if you were manually pressing them, the current operating mode affects how the program
executes. If you normally operate in RPN, verify your operating mode is set to either
Chain
or
Algebraic
before proceeding so you can follow along with the examples below.
For more information about setting the operating mode, refer to the section titled,
The Mode
Menu: Setting Preferences
in Chapter 1,
Basic Features
.
The volume of a sphere is represented by the equation,
. We will create a program that
can calculate the volume of a sphere without having to retype all the keys each time you wish
to calculate the volume of a given sphere. Verify your
FIX
setting is set for three digits to the
right of the decimal point. For more information on the
FIX
setting, refer to the section titled,
The Mode Menu: Setting Preferences
in Chapter 1,
Basic Features
.
Table 13-2
Keys
Display
Description
:E
Enters program mode. The first program is
selected.
I
Starts editing program 0. Note the
counter shows your current position in the
program.
:h3*
4/3*
:sI
I=
We have entered a program that takes
the currently displayed number, raises it to
the 3rd power, and multiplies it by 4/3 of
PI.
:
(HOLD)
The STOP instruction tells the calculator
that the program is ending. Note that to
enter that special instruction, you need to
press and hold the shift key, then press the
L
key (STOP) before releasing both
keys.
4
3
--
π
r
3