Page 70
70 Section 6: Programming Basics
This is the method used above, where h was placed in the X-register before running the program. No v instruction is necessary because program execution (here: ´A) both terminates digit entry and enables the stack lift. The above program then multiplied the contents of the X-register (h) by 2.
The presence of the stack even makes it possible to load more than one variable prior to running a program. Keeping in mind how the stack moves with subsequent calculations and how the stack can be manipulated (as with ®), it is possible to write a program to use variables which have been keyed into the X-, Y-, Z-, and T-registers.
2.Direct entry. Enter the data as needed as the program runs. Write a ¦ (run/stop) instruction into the program where needed so the program will stop execution. Enter your data, then press ¦ to restart the program.
Do not key variable data into the program itself. Any values that will vary should be entered anew with each program execution.
Program Memory
At power-up (Continuous Memory reset), the HP-15C offers 322 bytes of program memory and 21 storage registers. Most program steps (instructions) use one byte, but some use two. The distribution of memory capacity can be altered, as explained in appendix C. The maximum attainable program memory is 448 bytes (with the permanent storage registers—RI, R0, and R1 — remaining); maximum number of storage registers is 67 (with no program memory).
Example. Mother's Kitchen, a canning company, wants to package a ready-to- eat spaghetti mix containing three different cylindrical cans: one of spaghetti sauce, one of grated cheese, and one of meatballs. Mother's needs to calculate the base areas, total surface areas, and volumes of the three different cans. It would also like to know, per package, the total base area, surface area, and volume.
Contents
HP-15C Owner’s Handbook
HP Part Number 00015-90001 Edition 2.4, Sep
Legal Notice
Introduction
Contents
Contents
Display and Continuous Memory
Program Editing
Program Branching and Controls
Subroutines
Calculating With Complex Numbers
Indirect Display Control
Calculating With Matrices
Numerical Integration
Appendix D a Detailed Look at
Contents Appendix a Error Conditions
Appendix C Memory Allocation
Appendix E a Detailed Look at f
Programming Summary and Index
Contents Appendix F Batteries
Function Summary and Index
Subject Index
HP-15C Problem Solver
Quick Look at
Manual Solutions
To Compute Keystrokes Display
Programmed Solutions
Keystrokes Display
002 003 004 005 006 007 008 009 8313
KeystrokesDisplay
001-42,21,11
300.51
HP-15C a Problem Solver
Part l HP-15C Fundamentals
Keyboard Operation
Power On and Off
Getting Started
Section
Keying in Exponents
Prefix Keys
Changing Signs
I O m ´ P I l F T s ? t H b
Clear Keys
Digit entry not terminated
Display Clearing ` and −
Clears only the last digit
Two-Number Functions
Calculations
One-Number Functions
6532
13.0000
17 +
26.0000 22.0000 5000
78.0000
Numeric Functions
Number Alteration Functions
One-Number Functions
General Functions
Time and Angle Conversions
Trigonometric Operations
Pressing Calculates
Radians
Degrees/Radians Conversions
7069
40.5000
Logarithmic Functions
Hyperbolic Functions
Percentages
Power Function
Two-Number Functions
To Calculate Keystrokes Display
Calculates 3% of $15.76 the tax
Polar and Rectangular Coordinate Conversions
Enters the base number the price
Polar Conversion. Pressing
Keystrokes Display
Automatic Memory Stack Registers
Automatic Memory Stack Last X, and Data Storage
Automatic Memory Stack Stack Manipulation
Always displayed
Memory Stack, Last X, and Data Storage
Stack Manipulation Functions
Lost
Lost
22.2481
Last X Register and K
287.0000
12.9000
13.9 +
Calculator Functions and the Stack
20.6475
Order of Entry and the v Key
+15 X15
65.0000
Nested Calculations
7 +
69.0000
Arithmetic Calculations With Constants
5 ‛15 Keys
1000
Keystrokes Display Growth factor
000
322.5000
Storage Register Operations
Storing and Recalling Numbers
520.8750
Clearing Data Storage Registers
Storage and Recall Arithmetic
For storage arithmetic
For recall arithmetic
24 l-0
Problems
Overflow and Underflow
15.0000
Memory Stack, Last X, and Data Storage
Probability Calculations
Statistics Functions
60.0000
5764
Random Number Generator
270,725.0000
3422
Accumulating Statistics
Registers
Register Contents
20 z 61v 40 z 7.21 60 z 7.78 80 z l
20.00 40.00 60.00 80.00 Kg per hectare
Metric tons per Hectare, y
Σy2
Correcting Accumulated Statistics
20 w 20 z
Standard Deviation
Mean
40.00
Standard deviation about the mean nitrogen
Linear Regression
31.62
Application
Linear Estimation and Correlation Coefficient
Statistics Functions
Other Applications
70 ´j
Display Control
Display Continuous Memory
Fixed Decimal Display
234568
Scientific Notation Display
Engineering Notation Display
234567
Mantissa Display
Round-Off Error
Special Displays
Annunciators
12,345.67
Error Display
Digit Separators
12.345.6700
Continuous Memory
Low-Power Indication
Status
Resetting Continuous Memory
Page
Part ll HP-15C Programming
Creating a Program
Programming Basics
Mechanics
Loading a Program
Programming Basics
´b a
Running a Program
Intermediate Program Stops
002 003 004 005 006 007 008
How to Enter Data
300.51 300.51 ´A
Program Memory
Radius, r Height, h Base Area Volume Surface Area
Totals
007-44,40
002
004 005
010
Or G a
Program Instructions
Further Information
Instruction Coding
Memory Configuration
Keycode 25 second row, fifth key
Initial Memory Configuration
60 ´ m%
19 ´ m%
Program Boundaries
´ m %
19.0000
Abbreviated Key Sequences
Unexpected Program Stops
´bA ´b3 End of memory
¤ @ y ∕
User Mode
Polynomial Expressions and Horners Method
LOG %
002 003 004 005 006 007 008 009 0000
Nonprogrammable Functions
001-42,21,12
12,691.0000
Problems
Program Editing
Moving to a Line in Program Memory
Deleting Program Lines
Examples
Inserting Program Lines
Or use Â
Single-Step Operations
Release
Line Position
Âhold
Result
Insertions and Deletions
Initializing Calculator Status
+ i n
Interest
PV 1 + i n
100 270
´bA D ´4 O0 2* O1 2÷ * ´ ´ l0 l1 ´r * n
Program Branching Controls
Branching
Conditional Tests
Test
Flags
n will clear flag number n
Example Branching and Looping
014
010-45,20
013-43,30
016-44,40
Example Flags
Formula is
005-43, 4
002-43
004-42,21,15
006-42,21
48.0000
Go to
250.0000
10,698.3049
Looping
Conditional Branching
System Flags Flags 8
Program Branching and Controls
Subroutine Execution
Subroutines
Go To Subroutine and Return
´b.1
Subroutine Limits
003- O0
000 001- ´b9
002- R
004
´ b.4
´b.5
Subroutine Return
Nested Subroutines
V and % Keys
Index Register Loop Control
106
Index Register Storage and Recall
Indirect Program Control With the Index Register
Program Loop Control
Index Register and Loop Control
Exchanging the X-Register
Index Register Arithmetic
Indirect Branching With
Indirect Display Format Control With
Indirect Flag Control With
Loop Control With Counters I and e
Nnnnn x x x y y 5 0 0
Start count at zero Count by twos Count up to
Storing and Recalling Keystrokes Display
Examples Register Operations
Iterations
12.3456
Exchanging the X-Register
Example Loop Control with e
Storage Register Arithmetic
012-42, 5
Loop control number in R2
−− 011- 42
013- 22
15 O
Example Display Format Control
64.8420 0000 50.0000
Index Register Contents
Indirect Display Control
Index Register and Loop Control
118
Part lll HP-15C Advanced Functions
Creating the Complex Stack
Complex Stack and Complex Mode
Calculating With Complex Numbers
120
Complex Numbers and the Stack
Deactivating Complex Mode
Entering Complex Numbers
´ % hold 8.0000 release
Z 8 Y 7 X Keys
Stack Lift in Complex Mode
Manipulating the Real and Imaginary Stacks
Clearing a Complex Number
Or other operation
Continue with any operation
− 4 v Continue with any operation
´ %hold release
Entering Complex Numbers with −. The clearing functions −
0000 17.0000 144.0000
Entering a Real Number
Followed by another number
Entering a Pure Imaginary Number
´ Continue with any operation
´ O
Operations With Complex Numbers
Storing and Recalling Complex Numbers
L 2 ´
¤x N o ∕ @ a
+ * ÷ y
0428
2000
7000
0491
5708
Polar and Rectangular Coordinate Conversions
Complex Results from Real Numbers
´ % hold Release1.5708
Cos θ + i sin θ = re iθ Polar + ib = ∠ θ
2981
8452
+ 3.1434
2361
352.0000
872.0000
4721
For Further Information
Calculating With Matrices
138
Keystrokes Display Deactivates Complex Mode
= A-1B
11.2887
Matrix Dimensions
Running
2496
Dimensioning a Matrix
Number Rows Columns
´mA
Displaying Matrix Dimensions
Changing Matrix Dimensions
Keystrokes l B Display
Storing and Recalling Matrix Elements
Storing and Recalling All Elements in Order
⎡ a
Checking and Changing Matrix Elements Individually
Keystrokes Display
Storing a Number in All Elements of a Matrix
Matrix Operations
Matrix Descriptors
Result Matrix
Copying a Matrix
One-Matrix Operations
Calculating with Matrices
Scalar Operations
LB b
Elements of Result Matrix
LA a
Keystrokes Display Subtracts 1 from the elements
Arithmetic Operations
LB b 2 LA a 2
Matrix Multiplication
= AT B
Keystrokes Display l a a
Solving the Equation AX = B
86 OA
24 OA
2400
8600
274 OB 233 OB 331 OB 120.32 OB 112.96 OB 151.36 OB ´Á
Calculating the Residual
Week Cabbage kg 186 141 215 Broccoli kg 116
Using Matrices in LU Form
Calculations With Complex Matrices
Storing the Elements of a Complex Matrix
Then Z can be represented in the calculator by
Pressing Transforms Into
= ⎢
LA a
Complex Transformations Between ZP and Z
Inverting a Complex Matrix
Multiplying Complex Matrices
´ a
Keystrokes lA lB Display Displays descriptor of matrix a
´U lC LC lC lC lC lC lC lC ´U
Solving the Complex Equation AX = B
ZZ −1
AX = B
200.0000
170.0000
0437
0372
1311
1543
Calculating with Matrices
Using Matrix Descriptors in the Index Register
Using a Matrix Element With Register Operations
Miscellaneous Operations Involving Matrices
Stack Operation for Matrix Calculations
Conditional Tests on Matrix Descriptors
Calculating with Matrices
Using Matrix Operations in a Program
Keystrokes Results
Summary of Matrix Functions
´m a
Calculates residual in result matrix
For Further Information
Finding the Roots An Equation
Using
180
Finding the Roots of an Equation
Clear program memory
002 003
´b0
001-42,21
005 006 007
Finding the Roots of an Equation
Desired root
000 001-42,21,11
Keystrokes ¥
´ bA
003 004
Into X-register
5000 1 e t
Brings another t-value
200 t
When No Root Is Found
000 001-42,21 002 003 004 005
Error
Choosing Initial Estimates
Label
008 009
003 004 005 007
X + 8
6 x + 8
Finding the Roots of an Equation
Using in a Program
Restriction on the Use
Memory Requirements
Numerical Integration
Using f
194
002 003 004
4040
1416 7652
Begin subroutine with a label
$ ÷
3825
4401
6054
Accuracy of f
´ i ´ f
8826
7091
Using f in a Program
382
Memory Requirements
Appendix a
Error Conditions
Error 0 Improper Mathematics Operation
205
Error 1 Improper Matrix Operation
Error 2 Improper Statistics Operation
Error 5 Subroutine Level Too Deep
Error 3 Improper Register Number or Matrix Element
Error 4 Improper Line Number or Label Call
Error 6 Improper Flag Number
Pr Error Power Error
Stack Lift
Stack Lift Last X Register
Digit Entry Termination
Appendix B
Disabling Operations
Enabling Operations
Appendix B Stack Lift and the Last X Register Keys
Stack Stack Enabled. disabled 53.1301 No stack Lift
Neutral Operations
Nnn Clear u ¥
Last X Register
\ k + H ∆ \ h ÷ À P* q r c ‘ / N z ∕ P\ o j
Appendix C
Memory Allocation
Memory Space
Registers
Appendix C Memory Allocation
Memory Status W
Memory Reallocation
M % Function
´m% 1.0000 Whold 1 64
Restrictions on Reallocation
19 ´ m
Program Memory
Automatic Program Memory Reallocation
If executed
Memory Requirements for the Advanced Functions
Two-Byte Program Instructions
Together
Appendix C Memory Allocation
Appendix D
Detailed Look at
How Works
220
Appendix D a Detailed Look at
Accuracy of the Root
X4 =
000
1718
006 007 008 009 010-43,30 011 012-43,30 013
´ v B
Interpreting Results
0681
− 45 For 0 x
3x 45x 2 +
Test for x range
Branch for x ≥
End subroutine
1358
000.0000
Initial estimates
Possible root
Appendix D a Detailed Look at
007 008 009 010
´ b.0 001-42,21,.0 002 003 004 005
Bring x-value into X-register
013 014 015 016
017 018
10 v ´ ‛ 20
Error 0000 1250 5626
Finding Several Roots
Fx = xx a3 =
002 003 004 005 006 007
6667
Stores root for deflation
Same initial estimates
Second root
Deflated function value
Deflation for third root
Limiting the Estimation Time
Counting Iterations
For Advanced Information
Specifying a Tolerance
Appendix E
Detailed Look at f
How f Works
240
Accuracy, Uncertainty, and Calculation Time
X = π1 0π cos4θ − x sinθ dθ
0000 1416
´ i ´ f
Keystrokes ´ i Display
Keystrokes Display Return approximation to
´ Clear u Hold
´ f ´ Clear u hold
7858
7807
Uncertainty and the Display Format
Functions values for example
Δx = 0.5×10−n ×10m
= aδx dxb = ab 0.5×10−n + m x dx
Conditions That Could Cause Incorrect Results
∞ xe− xdx
001-42,21 002- 1 003 004 005
Appendix E a Detailed Look at f
Appendix E a Detailed Look at f
Conditions That Prolong Calculation Time
Approximation to integral
Keys lower limit into
Keys upper limit into
Uncertainty
Appendix E a Detailed Look at f
Obtaining the Current Approximation to an Integral
For Advanced Information
Batteries
Low-Power Indication
Installing New Batteries
Batteries
Appendix F Batteries
Verifying Proper Operation Self-Tests
2.C 3.H
Conversions
Function Summary and Index
Complex Functions
Digit Entry
Logarithmic Exponential Functions
Display Control
Index Register Control
Mantissa. Pressing
Matrix Functions
Mathematics
146
To ZP page164
Number Alteration
To XT
Stack Manipulation
Percentage
Probability
Clear u
Statistics
Storage
Trigonometry
Programming Summary and Index
269
Programming Summary and Index
Subject Index
271
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Subject Index
Federal Communications Commission Notice
Product Regulatory Environment Information
Modifications
Canadian Notice
Avis Canadien
European Union Regulatory Notice
Body number is inserted between CE