This is a general discussion of mathematical modelling. ( Model Types ) Some knowledge of algebra and the concepts of a mathematical function (math fn) are assumed. The concept of a Mathematical Function (math fn) is credited to EULER (ref: The History of Civilization,Vol. IX, p ).
Reverse Polish and infix are some of the other notations used. APL was developed as an algorithmic notation. It was made into a computer executable notation that can be written with an electric typewriter. Traditional mathematical or Algebraic notation evolved when paper, pens, and pencils were the writing tools. Notations that do not require super or subscripts and which employ conventional standard character symbols are much easier to use in text. APL used special symbols, J uses only ASCII symbols as found on most English language computer keyboards.
The late Ken Iverson who invented APL joined with Roger Hui and developed J.
Recall that most algebraic symbols were invented when writing was done with pens, pencils, etc. A typerwriter keyboard has limited space and only the most heavily used symbols such as: ' " ; + - = % / \ | [ ] ( ) { } ! @ # $ % ^ & * _ . ~ ` < > ? are represented. Many users of mathematics like other symbols than the conventional alphabets. Greek alphabetical symbols are favored by many.
The Roman alphabet used by the English language has no supplimentary accents, etc and forms the basis for systems in the English speaking and other parts of the world. Digital representation of symbols developed standard length digital words. Current systems use an eight bit word that has evolved from shorter versions. Eight bits allows 256 unique combinations. The current standard is called ASCII (American Standard Code for Information Interchange)
Each notation has advantages, supporters and detractors. You should choose one for your personal style. I have long used APL because it fitted my work. APL is relatively simple to understand if you are familiar with conventional Algebra. My inclination now is to convert to J because of increased power and use of only ASCII symbols. However it may not be easy to learn yet another language.
The common estimating techniques use simple mathematical models, that are often evaluated mentally, but may become sufficiently complicated and repetitive to warrant more formal processes. The current hierarchy is:
Models require assumptions about and measurements of behaviour. The better the models describe the behaviour the better the models will estimate or model the measurements of behaviour. For convenience a model is considered to receive input values that are independent variables and to produce outputs that are the dependent variables.


Reversibility, i.e. inter changeability of the dependent and independent variables may be possible in the model but impossible in nature. E.g.. Time is apparently irreversible, and the second LAW of Thermodynamics decrees increasing ENTROPY.
Fitting a model requires: a. Selection of a mathematical function which closely approximates behaviour; b. the estimation of the calibration constants.
Selection of the mathematical form can be avoided if sufficient calibration data are available. These data can be sorted on one or more of the independent variables and to form a table of the data values of the dependent variable which can then be plotted to reveal function shape. A model form is then selected, preferably one that will allow transformation of the data to producd an approximately linear relationship. The data now be used as parts of calibration arrays, and the coefficients determined.
Tablular Models:
A tabular model allows a great deal of freedom in the
shape of a relationship
and is particularly suited to situations where the correct mathematical
function may be difficult or uncertain. Tables can contain ranges and may
be one or 'n' dimensional arrays. The usual table is one or two dimensional
because of the limitations of the visual process, paper etc. Human and
machine memory is not so limited. Tabular models can also incorporate fuzziness,
i.e. give a range of dependent variable values for a set of independent
variable values that would produce a single result from a rigid model.
The table technique can be used when there are no mathematical relationships such as in telephone directories, tables of contents, lists of facts, etc. Large tables are often referred to as 'DATA BASES' and computers have led to the development of data and data base processing technology.
A mathematical model constructed as a table of dependent variable values is a tabular function. Intermediate values within the table can be estimated by some form of interpolation.
Lookup tables are also constructed by mathematical functions. These are the familiar function tables of values used to avoid complicated and repetitive calculations. Table lookup may be faster than complicated function evaluation for a computer as it usually is for a person. The values in the table can be efficiently retrieved as required by addressing. Fast and efficient searching of large tables is an essential part of Computer Science and Software Enginering.
The conservation laws that form the basis for accounting , engineering, science and other aspecsts of life or nature are SUM models. They assume that 'the whole' is equal to the SUM of the parts. For some processes this may not be true and 'the whole' may be greater than the sum of the parts. It can never be less if all the parts have been accounted for.
Y = X1 + X2 + X3 + ... + Xn (Xi may be positive or negative). i is a monotonic index beginning with 1, or 0.
In Easy Calc this is written as: =SUM(list of X1, X2, X3, ... cells)
In Lotus 123 this is written as: + X1 cell + X2 cell + X3 + .... etc.
In J this is written as: Y =. +/X
Where: X is a list of the various X's or parts.S
In APL this is written as Y ← +/ X
Where: X is a list of the various X's or parts.
These are verbalized as: Y is assigned the SUM (plus reduction) of the X's.
Y = aQ ¦ in conventional algebraic notation. The line passes through the origin.
Note: either or both a and Q may single quantities or lists (vectors). If both are lists they must be the same length or there must be some rule for matching one list with another. If a and Q are singletons they define a line in two dimensions. If they are vectors of length two then they define a line in three dimensions, and so on.
In J, Y =. a * Q; ifa and Q> are the same length, then:
($a) = $Q where $ is the shape primitive and is used to count
the number of items in the vectors.
In APL if a and Q are vectors of the same length, then: (ρ a) = ρ Q. where:
ρ is the shape primitive etc.
The APL multiplication primitive is x and the model is written as:
Y ← a x Q ¦ assumes a[n] is multipiled by Q[n]
Y equals fixed amount = C plus a rate = a multiplied by quantity = Q. This is a more general version of MODEL 2. because it allows the line to be offset from the origin (first degree polynomial). The constant term C defines the amount of the offset. ( See also the Polynomial Model )
Y = C + aQ or Y = aQ + C in Algebraic notation
(precedence rules multiply a by Q and add the result to C.)
When: 'a, Q, C' are singletons the model is a constant plus
directly varying amount, i.e. a straight line
in two dimensions that is not necessarily through the origin.
In J, Y =. C + a * Q; if a and Q are the same length, then:
($a) = $Q$ is the shape primitive and is used to count
the number of items in the vectors.
In both APL and J this expression can define a family of models if C is also a vector of proper dimensions.
In APL this model can be written as:
Y ← C + a x Q
where: C, a, Q may each be singletons or equal length vectors
If C, a, Q are equal length lists they define a single or family of straight lines, or surfaces. Note that the surfaces are planar even though they may be in more than two dimensions, i.e. a multidimensional linear model.
Y is the product of several constants and/or variables.
Y = abc . ... . n or Y = a x b x c x. ... . x n.
Note the model can include recriprical or ratio terms:
e.g. Y = a x (b/c) x d x (e/f)
In J this model can be written as: Y =. a * b * c, or Y =. */ X
In APL this model can be written as: Y ← a x b x c, or Y ← x/XY = abc/def where: a, b, c, d, e, f are seperate variables (algebraic)
i.e. Y equals (a times b times c) divided by (d times e times f), or
Y=a/d x b/e x c/f
In J this model can be written as:
Y =. %/ a,d,b,e,c,f
or simply as Y =. %/X (where: X is a properly ordered list of variables)
The APL model is the same as for J and can be written simply as:
Y ← ÷/a,d,b,e,c,f
or Y ← ÷/X
Y equals a quantity raised to a power.
Y = Xn
In J this expression is written as Y =. X^n
In APL this expression is written as Y ← X*n
e.g. a J version of Pythagoras' theorm on the properties of a right triangle:
a =. 3
b =. 4 ( assignments for a 3, 4, 5 Triangle )
c =. (+/(a^2),b^2))^0.5
(note the parentheses are necessary because J & APL have only order precedence rules)
Length of line (vector) by J shown below:
xyz =. 13 23 16 ( assignments of x, y, z projections)
%: +/ xyz ^2 answer is 30.8869 , ( note: %: is J primitive for square root)
The LOGARITHMIC functions are written similarly to the exponental functions above.
The natural Log of 'a' in J is: ^. a
The log of a to base n is: 10 ^, a
In J there are 23 variations of the circular function o. to give
the triginometric & hyperbolic functions, and their inverses. The
monadic version is equivalent to o. π (pi) times.
e.g.
o. 0.5 is π times 0.5 or a right angle in radians.
o. % 180 is the number of radians per Degree.
o. % 200 ¦ is the number of radians per Grad.
The common trig functions of the angle a in radians are:
Sine =. 1 o. ; Inverse, Sine-1 =. -1 o.
Cosine =. 2 o. ; Inverse, Cosine-1 =. -2 o.
Tamgent =. 3 o. ; Inverse Tangent-1 =. -3 o.
In APL there are 16 variations of the circular function Ο to give
the triginometric & hyperbolic functions, and their inverses. The
monadic version is equivalent to π (pi) times.
e.g.
Ο 0.5 is pi times 0.5 or a right angle in radians.
Ο ÷ 180 is the number of radians per Degree.
Ο ÷ 200 ¦ is the number of radians per Grad.
The common trig functions of the angle a in radians are:
Sine ← 1 Ο ; Inverse, Sine-1 ← -1 Ο
Cosine ← 2 Ο ; Inverse, Cosine-1 ← -2 Ο
Tamgent ← 3 Ο ; Inverse Tangent-1 ← -3 Ο
The meanings of the other circular fns are given in the APL idiom list page 8. Use Q workspace for acess.
‘cc'8' ¦ Trig Idioms#
In APL a polynomial can be written as:
Y ← X ⊥ A
where: A is a list of an, .... a2,a1,a0 ( The a's are the polynomial
coefficients, high order to the left.)
In J the expression c p. x is a polynomial with "coefficients" c.
"Polynomials are important for a number of reasons: (from J Studio Lessons, J home page )
To evaluate A at several points X must be a column (vector) The idiom for making column from a row is (X ø.+,0) Y(X ø.+,0) æ A ¦ is one of the expressions that can be used.
Example: Two degree polynommial: Y = 0.1X2 + 2X + 7
A = coeficients; X = values of x; and Y is list of y's
A ← .1 2 7
X ← 1 1.5 2 2.5 3
Y ← (X ø.+,0) ⊥ A