# Webscalp scientific calculator

## SUMMARY:

## Overview

**WebScalp** (web-based scientific calculator program) is a stack-based calculator that uses **Reverse Polish Notation (RPN).** This was popularlized by Hewlett Packard on their scientific calculators introduced starting in the 1970s. Ads at the time stated that this type of caculator "had no equal" because indeed they were without an "=" button. The RPN system of operation was more efficient for long calculations than the normal calculator wth an equals button.

In short, numbers entered into an RPN calculator like WebScalp get **pushed onto a stack**. Mathematical operations take place on the last number or the last two numbers pushed onto the stack. To add two numbers together, say 3 and 4, one would first push 3 onto the stack, then push 4 onto the stack, and finally add them together:

3 4 +

WebScalp adds the two numbers, pops the stack, and the result ends up on the top. A more complicated example is:

DEG 45 COS 2 SQRT *

...which is the sequence to calculate the cosine of 45 degrees multiplied by the square root of 2. The DEG ensures that angles are measured in degrees. Many functions are spelled out in words rather than assigning them to arbitrary and non-standard symbols. Some functions have more than one command that invoke them. For example:

RECIP and RECIPROCAL

... both calculate the reciprocal. Note that **upper and lower case are not significant** for commands.

WebScalp **displays the complete stack**, which is ten numbers deep. The **top of the stack is Z** -- that's where the answers appear. Deeper numbers on the stack are stored in Y, X and so on, all the way back through Q. There are also **ten memory locations** numbered M0 through M9 in which numbers can be stored for later retrieval and use.

## Number entry

Numbers can be entered in **fixed point**:

e.g., 3.142857

Numbers can be entered in **scientific notation**:

e.g., 3e8 or -42e-22

Fixed point numbers can also use the **suffixes** "p" (pico; multiply by 10^{-9}), "u" (micro; multiply by 10^{-6}), "m" (milli; multiply by 10^{-3}), "k" or "K" (kilo; multiply by 10^{3}), "M" (mega; multiply by 10^{6}), "g" or "G" (giga; multiply by 10^{9}), and "t" or "T" (tera; multiply by 10^{12}). Thus,

3M

...results in 3000000.

Numbers can be entered as binary using the suffix "b" or "B", or as hexadecimal using the suffix "x", "X", "h", or "H". This works for positive integers less than 2^{32} = 16^{8} = 4,294,967,296. For example,

10101010b and AAh

...both result in 170.

**Mixed numbers and fractions** can be entered as

1_2/3, 1+2/3, or 1-2/3 for one and two thirds or 3/4 for three quarters

...and the result will be converted to decimal.

**Degrees, minutes, seconds (or hours, minutes, seconds)** may be entered directly, separated by colons, as

30:32:22

for 30 degrees, 32 minutes, 22 seconds, and they will be converted to decimal degrees (hours). Fractions of seconds can also be entered as decimals as in

30:32:22.5

for 30 degrees, 32 minutes, 22.5 seconds.

**Degrees and decimal minutes (or more rarely, hours and decimal minutes)** may be entered separated by a colon as

30:30.625

for 30 degrees, 30.625 minutes, and the result will be converted to decimal.

For **geographical locations**, the prefix "W" or "S" will be considered to be the same as a negative sign while "N" and "E" are positive. For example,

W30.5 and S30.5

both give -30.5. These geographical prefixes also work with degrees:minutes:seconds and degrees:minutes.decimals.

## Polynomials

WebScalp can handle **polynomials** up to order 9 where the coefficients are stored in the memory locations M0 through M9. For example, f(z) = Az^{3} + Bz^{2} + Cz + D would be defined by the coefficients *A*, *B*, *C*, and *D* stored in memory locations M3 through M0. The coefficients can easily be entered on the stack and placed in memory. For example, the third-order polynomial F(z) = 2z^{3} + 9z^{2} + 4z + 1 can be defined using:

3 ORDER 2 9 4 1 POLY.

Assuming that the polynomial order has been set appropriately, then value of the polynomial for any value of Z can be evaluated using the commandFZ.

The **derivative** of a defined polynomial for any value of Z can be calculated using

DFZ.

A real root of a defined polynomial can be found by repeated applications of the

SOLVE

command, where Z is the initial estimate. This uses the Newton-Raphson method, one iteration per command. Different initial estimates and multiple uses of SOLVE may converge to different real roots where they exist. If no real root exists, repeated uses of SOLVE will not converge.

## Date and Time

Webscalp can do limited manipulation of **dates**. A valid date is an integer of the form: yyyymmdd (year in four digits, month in two digits, and date in two digits). The command

TODAY CAL

...will push the current date in valid format onto the top of the stack and display a three-month calendar with the current date highlighted. The calendar will remain as long as date manipulation commands are used.

Webscalp can also display the **time** as a four-digit integer (hhmm) using

NOW.

Note that the date and time are not necessarily local date and time of the user, but reflect the local time of the server where Webscalp is hosted. This can be changed by specifying a time difference (offset). For example,

-2 TDIF

will ensure that any further TODAY and NOW commands are based on a time two hours earlier than the Webscalp clock.

## Functions with several variables

Note that some functions requiring several variables can be entered in response to prompts to avoid confusion. These functions start with **@**. For example,

@DIST is a less ambiguous form of DIST that prompts for values in the command area.

TimmiT eclectic solutions and editing