Showing posts with label for loops. Show all posts
Showing posts with label for loops. Show all posts

Saturday, October 6, 2018

Retro Review: Hewlett Packard HP 11C

Retro Review:  Hewlett Packard HP 11C

HP 11C 

This is one calculator I sought after for a long time.  Thanks to Mark Hardman for donating the door prize at HHC 2018. 

General Information

Company:  Hewlett Packard
Type:  RPN Programmable
Display:  10 digits with 2 digit exponents
Power:  3 LR44 or A76 batteries
Memory:  up to 21 storage registers, up to 203 programming lines
Years:  1981-1989
Original Cost: $80
Documentation:  Manual

The HP 11C is an RPN programmable scientific calculator from Hewlett Packard. The calculator has four stacks (X, Y, T, Z) to use for calculations.  The 11C is part of the landscape series that Hewlett Packard produced in the 1980s, including the long-standing and still current selling HP 12C, the HP 15C, which got a short reprise in 2011-2012, and the beloved HP 16C.  The HP 11C does not have as many functions as the HP 15C, and we'll get to the comparisons later. 

Programming and Memory

The HP 11C has memory that shared between registers and program lines.   The HP 11C has 63 permanent lines of memory and one permanent register, R_I.  Note that R_I is also used as an indirect register.  The rest of the memory is a combination of up to a maximum of 20 registers or 140 additional program lines.  Each numerical register costs 7 lines of program lines.  Conversion from numerical register to program lines are automatic as program space increased in size.

The HP 11C allows for labels A, B, C, D, and E with numeric labels 0-9.  Program execution from labels A-E can be run directly from the keyboard. 
There are eight comparisons tests:  x ≤ y, x < 0, x > y, x > 0, x ≠ y, x ≠ 0, x = y, and x = 0.  If the comparison test is true, then the next step is executed.  Otherwise, the next step is skipped.

DSE (decrease, skip if equal) and ISG (increase, skip if greater) are present, uses the current value in R_I.  DSE and ISG are used for FOR loops, the format of R_I is nnnn.xxxyy, n is the current value, x is the final value, and y is the increment/decrements. 
There are two flag variables for the HP 11C: 0 and 1.  The three commands with flags are SF (set flag), CF (clear flag), and F? (is flag set?). There is no indicator when flags are set.

The Back of the HP 11C 

The back of the HP 11C contains important information:  four conversion formulas, two variable functions, statistics registers, ISG/DSE diagrams, and the meaning of seven error codes (0-6). 

Statistics

The HP 11C has linear regression (y = a*x + b).  The L.R. displays the intercept (b) in the X stack and slope (a) in the Y stack. 

Stat registers used:  R0 = n, R1 = ⅀x, R2 = ⅀x^2, R3 = ⅀y, R4 = ⅀y^2,  R5 = ⅀xy.   You will need at least 6 memory registers.

The Keyboard

The keyboard of the HP 11C matches the legendary reputation of Hewlett Packard calculators  have for keyboards. 

Final Verdict

Yes, I recommend the HP 11C for the collection.  If you want to find an HP 11C for sale, you are going to have shop for the best price because they are popular, like the HP 15C. 

And Now for the Comparison

HP 11C (top), HP 15C Limited Edition (bottom, sorry for the light blocking out the text)

The HP 11C does not have as many functions of the HP 15C.  First, the memory space is not as great (203 for the 11C, 448 for the 15C).  Also the HP 15C has integration, a solver, matrix, and complex numbers.  The tests for the 11C are right on the keyboard (the shifted functions of the arithmetic functions), while the 15C has the majority of tests through the TEST n command.

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Sunday, October 22, 2017

HP Prime: BREAK vs. CONTINUE

HP Prime:  BREAK vs. CONTINUE

Introduction

Ever needed to end a loop early?  Find yourself executing a loop where the counter becomes a value that causes an execution error?  An example where this might happen is a loop where a function is divided by the counter variable, and during the loop the counter variable takes the value of 0. 

The HP Prime offers two ways to mitigate potential problems in loops:

1.  You can terminate the loop at that point by using BREAK.

2.  You can skip that loop’s iteration by using CONTINUE.

You can specify how many loop structures are affected by using either the BREAK n or CONTINUE n format. 

A Simple Example

The programs LOOPED1 and LOOPED2 has a FOR structure that divides 10 by every integer from -5 to 5.   (10/-5, 10/-4, etc..)

We can see that the counter will have a problem when the variable reaches 0.  Division by 0 will cause an error and stop execution.  We are going to use BREAK and CONTINUE to mitigate this problem.

LOOPED1 – Break

EXPORT LOOPED1()
BEGIN
// Demonstration: BREAK
LOCAL x,y;
y:={};
// Loop
FOR x FROM −5 TO 5 DO
// Since we can′t
// divide by 0...
IF x==0 THEN
BREAK;
END;
y:=CONCAT(y,{10/x});
END;
RETURN y;
END;

When x=0, the for-loop is stopped.  As a result LOOPED1 returns:
{-2, -2.5, -3.333333333, -5, -10}


LOOPED2 – CONTINUE

EXPORT LOOPED2()
BEGIN
// Demonstration: CONTINUE
LOCAL x,y;
y:={};
// Loop
FOR x FROM −5 TO 5 DO
// Since we can′t
// divide by 0...
IF x==0 THEN
CONTINUE;
END;
y:=CONCAT(y,{10/x});
END;
RETURN y;
END;

In this case when the for-loop encounters x=0, that iteration is skipped and the loop continues.
Result:  {-2, -2.5, -3.333333333, -5, -10, 10, 5, 3.333333333, 2.5, 2}

Eddie


This blog is property of Edward Shore, 2017.

Basic vs. Python: Circle Inscribed in Circle [HP 71B, Casio fx-CG 100]

Basic vs. Python: Circle Inscribed in Circle Calculators Used: Basic: HP 71B Python: Casio fx-CG 100 Introduction ...