Previous
Reverse Polish notation |
lojbau mekso: Mathematical Expressions in Lojban
The Lojban Reference Grammar |
Next
Using Lojban resources within mekso |
The following cmavo are discussed in this section:
.abu BY letter ``a'' by BY letter ``b'' cy BY letter ``c'' fe'a VUhU nth root of (default square root) lo'o LOhO terminator for LIAs befits a logical language, Lojban has extensive provision for logical connectives within both operators and operands. Full details on logical and non-logical connectives are provided in Chapter 14. Operands are connected in afterthought with selma'o A and in forethought with selma'o GA, just like sumti. Operators are connected in afterthought with selma'o JA and in forethought with selma'o GUhA, just like tanru components. This parallelism is no accident.
In addition, A+BO and A+KE constructs are allowed for grouping logically connected operands, and ``ke ... ke'e'' is allowed for grouping logically connected operators, although there are no analogues of tanru among the operators.
Despite the large number of rules required to support this feature, it is of relatively minor importance in the mekso scheme of things. Example 17.1 exhibits afterthought logical connection between operands:
17.1) vei ci .a vo ve'o prenu cu klama le zarci ( three or four ) people go-to the market.Example 17.2 is equivalent in meaning, but uses forethought connection:
17.2) vei ga ci gi vo ve'o prenu cu klama le zarci ( either 3 or 4 ) people go-to the market.Note that the mekso here are being used as quantifiers. Lojban requires that any mekso other than a simple number be enclosed in parentheses when used as a quantifier. This rule prevents ambiguities that do not exist when using ``li''.
By the way, ``li'' has an elidable terminator, ``lo'o'', which is needed when a ``li'' sumti is followed by a logical connective that could seem to be within the mekso. For example:
17.3) li re su'i re du li vo lo'o .onai lo nalseldjuno namcu the-number two plus two equals the-number four or else a non-known number.
Omitting the ``lo'o'' would cause the parser to assume that another operand followed the ``.onai'' and reject ``lo'' as an invalid operand.
Simple examples of logical connection between operators are hard to come by. A contrived example is:
17.4) li re su'i je pi'i re du li vo the-number two plus and times two equals the-number four. 2 + 2 = 4 and 2 × 2 = 4.
The forethought-connection form of Example 17.4 is:
17.5) li re ge su'i gi pi'i re du li vo the-number two both plus and times two equals the-number four. Both 2 + 2 = 4 and 2 × 2 = 4.
Here is a classic example of operand logical connection:
17.6) go li .abu bi'epi'i vei xy. te'a re ve'o
su'i by. bi'epi'i xy. su'i cy.
du li no
gi li xy. du li vei va'a by. ku'e
su'i ja vu'u fe'a
vei by. bi'ete'a re vu'u
vo bi'epi'i .abu bi'epi'i cy. ve'o [ku'e] ve'o
fe'i re bi'epi'i .abu
if-and-only-if the-number ``a''-times-( ``x'' power two )
plus ``b''-times-``x'' plus ``c''
equals the-number zero
then the-number x equals the-number [ the-negation-of( b )
plus or minus the-root-of
( ``b''-power-2 minus
four-times-``a''-times-``c'' ) ]
divided-by two-times-``a''.
Iff ax2 + bx + c = 0,
then x =-b ± Ö
(b2 - 4ac)
-----------------------
2a
Note the mixture of styles in Example
17.6: the negation of b and the square root are represented
by forethought and most of the operator precedence by prefixed
``bi'e'', but explicit parentheses had to be added to group the
numerator properly. In addition, the square root parentheses
cannot be removed here in favor of simple ``fe'a'' and ``ku'e''
bracketing, because infix operators are present in the operand.
Getting Example 17.6 to parse perfectly
using the current parser took several tries: a more relaxed
style would dispense with most of the ``bi'e'' cmavo and just
let the standard precedence rules be understood.
Non-logical connection with JOI and BIhI is also permitted between operands and between operators. One use for this construct is to connect operands with ``bi'o'' to create intervals:
17.7) li no ga'o bi'o ke'i pa the-number zero (inclusive) from-to (exclusive) one [0,1) the numbers from zero to one, including zero but not including oneIntervals defined by a midpoint and range rather than beginning and end points can be expressed by ``mi'i'':
17.8) li pimu ga'o mi'i ke'i pimu the-number 0.5 plus-or-minus 0.5which expresses the same interval as Example 17.7. Note that the ``ga'o'' and ``ke'i'' still refer to the endpoints, although these are now implied rather than expressed. Another way of expressing the same thing:
17.9) li pimu su'i ni'upimu bi'o ma'upimu the-number 0.5 plus [-0.5 from-to +0.5]Here we have the sum of a number and an interval, which produces another interval centered on the number. As Example 17.9 shows, non-logical (or logical) connection of operands has higher precedence than any mekso operator.
You can also combine two operands with ``ce'o'', the sequence connective of selma'o JOI, to make a compound subscript:
17.10) xy. xi vei by. ce'o dy. [ve'o] ``x'' sub ( ``b'' sequence ``d'' ) xb,d}
Previous
Reverse Polish notation |
lojbau mekso: Mathematical Expressions in Lojban
The Lojban Reference Grammar |
Next
Using Lojban resources within mekso |