Arithmetic

On a previous page, you learned the Shwa numerals and signs. On this page, we'll discuss the symbols needed to express basic arithmetic.

Addition

In English, we use + to separate numbers being added together, but when we enclose a total in a larger expression, we have to surround it with parentheses or brackets, as in [4+3]. In Shwa, we simply draw a line over a sequence of expressions - numbers or larger formulas - to indicate that they should be added together, with dots separating the expressions.

The second example shows little decorations I'll call valances at each end of the overline. We sometimes use them to make it clearer where the overline begins and ends.

The two-dimensional (2D) format above is how the formula should be written or displayed, but when an expression is read aloud or entered on a keyboard, you need its one-dimensional (1D) format:

In the 1D format, we just enter the correct valances, and the renderer should complete the overline.

Subtraction

To indicate subtraction, we insert a vertical line before the number(s) being subtracted. In the 2D format, the vertical line hangs from the overline. You can subtract individual numbers or expressions no matter where they are in the sequence, even first - this is the correct way to indicate the negation of an expression (the negative sign is for negative numbers).

Multiplication

Multiplication works just like addition, except the line is underneath.

Division

Finally, division uses the same vertical line, but sitting on the underline. As with subtraction, you can divide individual numbers anywhere in the sequence.

Reciprocals

Division can be used to indicate the reciprocal of any expression (the fraction sign can only be used with integers).

Combination

These four operations can be combined without fear of ambiguity (and without precedence rules).

Powers

We read the English expression as three squared or three to the second power: 3 is the base, 2 is the power or exponent, and the operation is called exponentiation. When using keyboards, the same expression is often written 3^2, since most keyboards can't write superscripts.

In Shwa, we link the base and the power with a diagonal step that goes over the base and under the power, which can occur in either order.

Roots

If 9 is 3 squared, then 3 is the square root of 9, the number which, when squared, reverts to the original. Just as we use a vertical line to mark subtraction and division, the reverse operations of addition and multiplication, we use a vertical line with exponentiation to mark roots. The square root is mathematically equivalent to the one-half power.

Logarithms

Roots are the reverse operation of powers, but logarithms are the inverse operation of powers, in the sense that if bª = c, then a = logb(c). Shwa uses the same notation to indicate logs as it does for powers and roots, but this time with a vertical line in front of the base.

Formulas

All of the above can be combined into formulas. Here's a complicated example - the quadratic formula in 2D format. I've used the letters p t k to represent the coefficients of the quadratic px² + tx + k = 0, whose roots are the solutions to the formula.

-t + √(t² - 4pk)
2p

(It's not correct to use ± before the root, since both square roots are added - one of them just happens to be negative.)

Names

As the above formula shows, Shwa also uses letters within formulas to spell the names of constants, variables and functions.

By convention, one-letter names are used for temporary names like the variables in the quadratic formula above, while customary names get longer meaningful abbreviations. For example:

Unlike some computer languages, Shwa doesn't include digits in names. That's because any letters in front of numbers, with no spaces, are units - units always go ahead of numbers in Shwa. For example, kg1°81, with no spaces, is how we write 81 kilograms.

We use low tone marks and the Long mark within compound unit names:

For example, man-hours would use the Level mark, square meters would use the Rising mark, and kilometers per hour would use the Long mark.

Note the use of magnitude notation: these are all real numbers, not integers.

Functions

Functions not only have names; they also have arguments, parameters being passed to the function. For example, the famous trigonometric functions sin(p) cos(p) tan(p) all require an angle p. In Shwa, we use a box notation for the function and its arguments, separated by spaces. If the result of one function is an argument to another, the boxes may nest, as shown below.

Natural Arithmetic

The next three sections deal with natural arithmetic, in which there are no negative or real numbers. The operators all use a doubled vertical line.

Absolute Value

A doubled subtraction sign is used as a unary prefix to indicate a positive number, or the Absolute Value of a number (the number without the sign).

Difference

The difference sign is used between numbers to indicate a special form of subtraction whose result is always positive: difference. For example, we say that New York is the same distance from San Francisco as San Francisco is from New York, not its negative.

Modular Division

The two Modulo functions - quotient and modulus - are a variant of division. The main use of these functions is to perform conversions of numbers from one form into another: into integers, real numbers, or multiples of a modulus. In the expressions a quot b or a mod b, a is called the dividend and b is called the divisor. The result of quot is called the quotient, and the result of mod is called the modulus or remainder.

If the dividend and divisor are both natural numbers (positive integers, including zero), then the quotient and remainder are also both natural numbers, and the following three properties hold:

For example, consider 7÷4. Using normal (real) division, the result is 1.75, and if you multiply the divisor by the quotient, you get the dividend: 7 = 4 × 1.75. But using modular division, the quotient would be 1 with a remainder of 3, and 7 = 4 × 1 + 3.

When the dividend and divisor aren't both natural numbers, the results are more complicated, but the same three properties always hold. When the divisor is negative, so is the remainder. When the dividend or divisor is real, so is the remainder. When the divisor is 1, the remainder is the fractional part of the number: 0 ≤ r < 1. When the divisor is zero, so is the quotient but not the remainder (and the division is valid)!

The two signs are used more often than you might think, for dates and times, for example, or to separate numbers into integer+fraction, or real+imaginary, or larger+smaller than an arbitrary size. For instance, if you want to know how many 8-packs of hot dog buns you'll need for five 6-packs of hot dogs, it's (5×6) quot -8 (the divisor is negative so the remainder is negative: leftover buns).

Equalities

Shwa offers symbols for seven equalities. They're double-wide, and centered in a four-wide space.

The equal sign is represented in Shwa by a big double-wide T, showing the two sides are balanced:

The unequal sign is the same T, but upside down:

These two signs combine to form the four inequalities:

There is also a sign for approximate equality, which is sometimes used as a general symbol for ambiguity.

There is a different sign for equivalence, which means "not identical, but equal in some quality". For example, this is the relationship between the two square roots of negative 1. It might be used outside of arithmetic to match corresponding items, e.g. English cat ↔ French chat.

Finally, there is a sign for assignment or definition, which means "the value of the expression on the left is being assigned to the item on the right". Note that in Shwa, the assignment goes from left to right.

And here's the same thing in 1D form, as you would type it on a keyboard:

Recap of Symbols

To recap, here are all the symbols in the Shwa script :

Formula Keyboard

All these symbols are available on the keypad, in Formula mode.

To shift into Formula mode, use the √ key followed by the Formula mode key:

That's all you need to write Shwa!

If you're interested, the link at right below leads to a set of pages describing another number system, the balanced dozenal or Janus numbers, and a metric system based on them. They are an example of a very different numeric "language" that the Shwa script enables. But you don't have to learn them to use Shwa, any more than you need to learn Zulu or Inuktitut to write English in Shwa.


< Numerals Janus Numbers >


© 2002-2016 Shwa shwa@shwa.org 03oct16