HP 35s

The HP 35s (F2215A) is a Hewlett-Packard non-graphing programmable scientific calculator. Although it is a successor to the HP 33s, it was introduced to commemorate the 35th anniversary of the HP-35, Hewlett-Packard's first pocket calculator (and the world's first pocket scientific calculator). HP also released a limited production anniversary edition with shiny black overlay and engraving "Celebrating 35 years".

Features
The HP 35s uses either Reverse Polish Notation (RPN) or algebraic infix notation as input.

Other features of the HP 35s include:


 * Two-line alphanumeric LCD
 * Over 800 memory registers (26 directly labelled)
 * Scientific and statistical functions
 * Operation in decimal, binary, octal, hexadecimal
 * Equation solver with arbitrary variable isolation (first seen on the HP-18C)
 * Numerical integration (first seen on the HP-34C)
 * Support for input and display of fractions
 * Complex number and vector calculations
 * Unit conversions and table of physical constants
 * Keystroke programmability with approximately 30 kilobytes of memory for programs and data

The HP 35s has been given a retro look reminiscent of classic HP calculators from the 1970s to the 1990s. However, it provides far more functions, processing power, and memory than most of those earlier models.

The physical appearance and keyboard layout of the HP 35s is very different than that of its immediate predecessor, the HP 33s, but the two calculators are functionally very similar. The primary differences are:


 * The HP 35s allows both label and line number addressing in programs. The HP 33s had only label addressing. With only 26 labels, it was difficult to write programs making use of the entire 30 KB of memory.
 * The memory in the HP 35s is also usable for data storage, in the form of an extra 801 numbered memory registers.
 * Support for vector operations is new in the HP 35s.
 * Complex numbers are treated as a single value instead of two separate values.
 * Indirect branching, which allows the contents of a memory register to be used as the target of a branching instruction (GTO or XEQ) is omitted from the HP 35s.
 * No arbitrary limit to length of equations (the 33s had a limit of 255 characters).
 * Algebraic mode uses typical infix notation (algebraic mode in the 33s used a hybrid of infix and immediate execution notation, and the 33s did not include the ability to delete previously entered parts of an equation while it is being entered).

HP has released a free-of-charge 35s emulator for the Windows operating system (and Wine). This was previously only available to teachers for classroom demonstration purposes.

Construction
The HP 35s was designed by Hewlett-Packard in conjunction with Kinpo Electronics of Taiwan, which manufactures the calculator for HP in mainland China.

According to HP, the calculator has been engineered for heavy-duty professional use, and has been tested under extreme environmental conditions. It is built using 25 screws for rigidity and ease of maintenance.

The case features many design elements from 1970s HP calculators such as the ground-breaking HP-65, including a black case with silver-striped curved sides, slope-fronted keys, and gold and blue shift keys. The faceplate is metal, bonded to the plastic case. The key legends are printed, rather than the double-shot moulding used in the vintage models.

The calculator is powered by two CR2032 button cells connected in parallel, which it is advised to replace one at a time, to avoid memory loss.

It was initially supplied with a hard zippered clamshell case with a pocket for notes, and a printed manual, but this was later changed to a slipcase made of vinyl-covered cardboard with elastic sides and velvet lining, and a CD-ROM containing a PDF manual.

The calculator is entirely self-contained; there is no facility for upgrading the firmware, nor for loading/saving programs and data.

Reception
The build quality and industrial design of the 35s has been welcomed by reviewers as a return to the best HP professional calculator traditions, in contrast to their more recent advanced calculators which were seen as feature-packed and heavily styled for the student market, but in some cases poorly designed and built. Particular mention has been made of the traditional HP feel of the keyboard with a big key back in its traditional place. Shortcomings which have been identified include the lack of any facility for communication with a computer (for loading and saving programs and data), and sluggish performance.

Response to the calculator's logic has been mixed. The increase in addressable registers and introduction of program line-number addressing have been seen as a big improvement over the 33s. While welcoming the improved handling of complex numbers compared to the 33s, the incomplete support for them has been criticised. Working with hexadecimal and other non-decimal bases has been criticised as requiring excessive and unintuitive keystrokes. Several firmware bugs have also been reported, which have not yet been fixed.

The 35s's lack of communication abilities makes it acceptable for use in some professional examinations where more powerful calculators would not be. For example, in the US, it is the most powerful programmable calculator approved for use in the Fundamentals of Engineering (FE) and Principles and Practice of Engineering (PE) examinations.

Entry modes
The 35s supports both RPN and algebraic entry modes. Like most HP calculators, it defaults to RPN. The entry mode can be easily changed by the user. An annunciator on the display indicates the current entry mode.

In RPN mode, it uses a four-level stack, as have all HP's non-graphing RPN calculators since the earliest days. In contrast to the usual computer-science terminology, RPN calculators such as this refer to the operational end of the stack as the bottom and the far end as the top. The stack levels are named X (the bottom), Y, Z, and T (the top); they have no connection with the variables of the same names. Level X appears on the lower line of the display and level Y on the upper line. Each stack level can contain any of the data types supported by the machine: real number, complex number, or vector. Various functions are provided for manipulating the stack, such as and  to roll,  to swap X and Y,  to recall the last-used X value, and  to swap X and a named variable.

Algebraic mode works by the user entering an expression, then pressing to have it evaluated. The expression appears on the upper line of the display, the result on the lower line. The expression can be edited using the arrow and backspace keys, and re-evaluated as desired.

Units and fractions
In keeping with the calculator's retro theme, conversions between Imperial/US units and the equivalent standard metric units feature prominently on the 35s's keypad. To facilitate those who still use traditional units, and for other uses, the calculator also allows the entry of values as mixed fractions and the display of values as mixed fractions.

Entry of mixed fractions involves using decimal points to separate the parts. For example, the sequence  converts $3 15⁄16$ inches to 10.0 cm (approximately).

The calculator may be set to automatically display values as mixed fractions by toggling the key. The maximum denominator may be specified using the function. Numbered flags may be set to specify which of three denominator systems is to be used: most precise denominator, factors of the maximum (for example 2, 4, 8, 16, when the maximum is 16), or a fixed denominator. Two small arrow symbols on the display indicate if the actual value is slightly above or below that displayed. There are no functions to directly extract the parts of the displayed fraction.

Complex numbers
Previous (and other current) HP calculators have handled complex numbers in a variety of ways. In the HP 33s, complex numbers were stored as two separate values, and the "complex" modifier was used to indicate that an operation was to treat the stack as containing complex numbers. For example, adding $12 + 34i$ and $56 + 78i$ involved the following keystrokes:, which used up all four stack levels.

The 35s stores complex numbers as single values, which can then be operated on in the standard ways. The above example of adding $12 + 34i$ and $56 + 78i$ then becomes:.

On the 35s, the number of functions able to handle complex numbers is limited and somewhat arbitrary. For example, directly taking the square root of a negative real number results in an error message instead of a complex number. This is strictly correct given that a nonnegative real number a has a unique nonnegative square root and this is called the principal square root which is denoted by √a. The symbol √ is called the radical sign or radix. For example, the principal square root of 9 is 3, which is denoted by √9 = 3, because 32 = 3 • 3 = 9 and 3 is nonnegative. However raising x to the power of 0.5 using the key works if the number is entered as a real number with a complex part equal to zero. Inverse and hyperbolic trigonometry functions cannot be used with complex numbers. Base-e (natural) logarithms and exponentiation can be used, but not base-10. However, workarounds exist for many of those limitations.

Complex numbers can be entered in either rectangular form (using the key) or polar form (using the  key), and displayed in either form regardless of how they were entered. They can be decomposed using the (radius r) and  (angle Θ) functions. There are no functions for extracting real and imaginary parts, though that can be worked around, using the formulas $Re = r cos Θ$ and $Im = r sin Θ$.

Vectors
The 35s provides facilities for handling vectors of up to three real-number elements. A vector may be stored on the stack, or in any variable, as a single value, and processed by various functions. It is entered by the user starting with a square bracket, then the element values separated by commas. Vectors can be added, subtracted, multiplied and divided by scalars. Two vectors of similar dimensions may be added and subtracted, and multiplied to give their dot product. The function will return a vector's magnitude. A cross-product function is not available, nor any function to extract individual elements from a vector, but these can be readily calculated by the user.

Vectors can also be used to simply store up to three real numbers together, thereby increasing the calculator's storage capacity, though with more complexity and reduced speed. HP have published program code for the 35s which enables this.

Number bases
The calculator can be set to display values in binary, octal, or hexadecimal form, as well as the default decimal. When a non-decimal base is selected, calculation results are truncated to integers.

Regardless of which display base is set, non-decimal numbers must be entered with a suffix indicating their base, which involves three or more extra keystrokes.

When hexadecimal is selected, the row of six keys normally used for floating-point functions (trigonometry, logarithms, exponentiation, etc.) are instead allocated to the hex digits A to F (although they are physically labelled to ).

In non-decimal bases, the word length is fixed at 36 bits, and uses two's complement negation. Six bitwise operations are available:, , , , , and.

Statistics and probability
The 35s's statistics capabilities are fairly standard. It can process a set of one-variable or two-variable statistics. Calculated results include means, weighted mean, standard deviation, and linear regression figures. The summation registers are also accessible for further calculations.

Probability functions (combinations and permutations) are available, as well as random numbers.

Memory and variables
The 35s provides 30k bytes of user memory, which is shared among data, stored equations, and programs.

Since complex numbers and vectors of up to three elements can be stored as a single value, each data variable occupies 37 bytes, enough for a type indicator and three floating-point numbers.

The 26 alpha-labelled variables and the six statistics registers are permanently allocated; the rest of the memory space can be occupied by up to 801 more variables which can only be accessed indirectly. Indirect access to any variable is achieved by storing its sequence number (0 upwards) in the or  variable as a pointer and then accessing the variable via  or. The indirect variables are allocated automatically; storing a non-zero value in one results in the allocation of all variables with sequence numbers up to and including the one specified. Conversely, storing a zero value in the highest-allocated indirect variable results in the automatic deallocation of indirect variables downwards until a non-zero value is encountered. Attempting to read a non-allocated variable results in an error. It is therefore common practice to store a dummy non-zero value in a higher-numbered variable than is needed, to ensure that all lower-numbered variables are made available regardless of their values. The permanently allocated variables and the statistics registers may also be accessed indirectly, using negative sequence numbers of -1 to -32.

The calculator provides a set of 41 mathematical and physical constants, which may be scrolled through and selected using the key. A set of 12 binary flags are available; every flag can be set by the user to determine the behaviour of the calculator, five of these may be used for any purpose.

Stored equations occupy a byte for each character and three bytes overhead.

Program steps occupy three bytes. Steps which specify values or equations occupy more memory, as indicated above.

The amount of used and available memory can be readily checked by the user, but not by programs. The user can clear all indirect variables above a specified number, with the function.

Equations
As well as variables and programs, the user can store any number of equations in the calculator. "Equations" in this context means expressions ( f(x,...) ), equalities ( f1(x,...) = f2(x,...) ), and assignments (y = f(x,...)), which are each handled in different ways. Equations typically include named variables whose values are to be supplied by the user at run time, but can also take values from the stack.

Equations are entered in algebraic notation, even when RPN entry mode is active. They are stored in a list which is accessed with the key, allowing the user to scroll through the list, add, edit and delete equations, and select an equation to be processed.

An equation may be processed in a number of ways.
 * It may be evaluated using the or  key, with the user being prompted to enter values for the included variables. In the case of an assignment, the target variable receives the result.
 * It may be solved for any one of the included variables, using the function. The calculator uses its logic to attempt to isolate the value of the required variable, after prompting the user for the values of the other variables. Since this process takes time, and the equation may have more than one solution, it is guided by two "guesses" which it assumes to have been provided by the user, in the stack's X register, and in the variable's existing value.
 * It may be integrated, using the function. The user first places the two interval limits on the stack, then selects the equation and the  function, which prompts for the name of the variable to be integrated and the values of the other variables.

There are also two built-in entries in the equations list, to allow solving all variables in a system of linear equations. Systems of two equations with two variables, and three equations with three variables, are supported.

Solving and (especially) integrating equations take both time and memory. Efficiencies may be made by reducing the display precision and ensuring enough memory is available.

Since the content of an equation is not validated unless and until it gets processed, it may contain any sequence of characters, including text strings. This may be taken advantage of in order to include lines of notes in the equations list (as is shown in the main picture at the top of this page).

Programming
The HP 35s is keystroke-programmable, meaning that it can remember and later execute sequences of keystrokes to solve particular problems of interest to the user. Program keystrokes are fully merged: functions accessed via shift keys or menus are recorded as one keystroke, not two or more. These keystroke programs, in addition to performing any operation normally available on the keyboard, can also make use of conditional and unconditional branching and looping instructions, allowing programs to perform repetitive operations and make decisions.

All programs are stored in one continuous program space, and may be created and edited by switching to programming mode, using the key. Within the program space, up to twenty-six alphabetic labels may be defined in the form, and each label may be followed by up to 998 other steps, so that any step may be targeted by a ("go to") or  ("execute") instruction in the form  (or just  for the label step itself, A001). Any steps before the first label are numbered with four digits, but these steps cannot be targeted. Subsequent insertion or deletion of steps in program space results in the automatic correction of GTO/XEQ instructions to reflect changes to the targeted step numbers. It is conventional to use each label to mark the start of a separate program, so that any program may be executed by a command in the form. Program execution can be interrupted or resumed by pressing the ("run/stop") key, and the program step pointer can be moved using the  and  keys. There is no connection between program labels and the variables of the same names.

As in normal operation, programming can be done in either RPN or algebraic (infix) mode. RPN-mode programs are usually smaller and faster.

Here is a sample program that computes the factorial of an integer number from 2 to 69 (ignoring the calculator's built-in factorial/gamma function). There are two versions of the example: one for algebraic mode and one for RPN mode. The RPN version is significantly shorter.

Algebraic version:

RPN version:

Equations may be embedded in programs, as a single program step. The calculator's settings include a numbered flag which specifies whether equations in programs are to be evaluated or displayed at run time. Since an equation can contain any sequence of characters, it may be composed as a message to be displayed. After displaying a message, the program either stops until is pressed, or if a  (pause) instruction follows the message then it pauses for one second before continuing.

Programs may be solved and integrated in much the same way as equations. Instead of selecting an equation from a list, the user presses, then the program's label, and either or , which prompts for the name of the target variable. The existing values of the other variables are used, unless the program contains instructions to make the program prompt for a value. In the case of solving, the program is treated as an expression whose return value (the value left on the stack) should be zero. Programs can also contain instructions for solving and integrating other equations/programs.