PADCALC (16K ZX81)
by B R Law
from Your Computer (September 1983), Pages 173-175

Padcalc is a general-purpose mathematical program that will allow up to five formulae to be entered for subsequent calculation. It is most useful when only a limited number of "what if?"-type calculations are required, and under these circumstances it is easier to set up than a spreadsheet program and the format is more readily understandable.

In general terms using Padcalc is the computer equiavlent of paper and pencil because it works in the same way you would if working through a formula or series of formulae. It initially asks you to enter your formula containing all of its variables. When you have entered your last formula press Newline and it will list all variables for which it requires you to enter values. You will notice that it does not ask for a variable if this has been calculated previously or if the same variable was used in a previous formula.

The cursor over the variable letter indicates that it is waiting for you to enter a value against this letter; when this is done it moves to the next variable. When the last variable is entered the results are automatically calculated and printed below the variables.

At this stage the cursor over the last variable letter begins to flash, indicating that you can now change the value of one of the variables. The cursor can be moved up and down in response to the cursor keys 6 and 7 and when key V is pressed a new value for the variable on which the cursor sits can be entered.

Variables can continue to be changed in this manner until key C is pressed. A new set of results are then calculated and the result is printed adjacent to the first set. This process can be continued until four sets of variables and results are printed on the screen. Any further changes will result in the screen being cleared and the next set of results are printed down the first row.

A warning that this will happen is given at the bottom of the screen after four sets of results have been calculated. The following types of functions can be used in the formula: +, -, *, /, **, E, Sin, Cos, Tan, Asn, Acs, Atn, Rnd, Int, Sqr, PI, Abs

There are, however, certain constraints that should be applied when entering a formula, and they are as follows.

No more than five formulae may be entered at any one time.

Variable names should be no more than two characters long and if numerics are included they should be put after an alphabetic character. For example, A1, V2 and so on.

When using trigonometric functions a single alphabetic character only can be used and any angle must be given a variable name. A numeric angle will not be accepted in a formula. For example Sin 30 degrees should be entered as Sin A. The angle can then be entered as a variable.

All angle variables should be entered as decimal degrees. For example, Sin 30 degrees 30 minutes should be entered as Sin 30.5 degrees.

All answers involving degrees are given in decimal form.

When using the functions Sin, Cos and Tan the variable which the function acts upon has initially to be multipled by PI/180 to change degrees to radians. In cases where the variable has no brackets around it the PI/180 is inserted immediately after the function by the program. When brackets are present PI/180 is inserted inside the first bracket. Therefore, if brackets are required always put on an additional set. For example, Sin A; Sin (A*B); Sin ((A+B)).

Now an example to clarify the entry procedures. This example uses the program to calculate various features of a gear. The variables used are defined as follows:

    PD = Pitch circle diameter
    OD = Outside diameter
    RD = Root diameter
    TT = Tooth diameter
    N  = Number of teeth
    DP = Diametrical pitch

After loading the program using Load "Padcalc" you should receive a prompt asking for the first formula. Proceed as follows:

    PD=N/DP           [NEWLINE]
    OD=PD+2/DP        [NEWLINE]
    RD=OD-2*2.25/DP   [NEWLINE]
    TT=1.5708/DP      [NEWLINE] [NEWLINE]

The screen should now have a black cursor visible over the letter N. Now enter the value for N, for example 45 [NEWLINE]. The cursor jumps to DP so enter a value for this, for example, 11 [NEWLINE]. After this last entry the answers are automatically calculated and displayed against their respective variables.

After this either of the two variables can be changed by shifting the cursor using keys 6 or 7 then pressing key V and entering the new variable. To see the new results press C for recalculation. For example, 7 V 15 [NEWLINE] will recalculate the results with the number of teeth changed to 15.