From Mathcad to Maple
A section of linguistics called comparative philology allows derivation of common regularities appropriate to various languages. A foreign language study is usually based on comparative philology: it is one business to teach English to Germans, and quite another – to Chinese. Learning software environments shows about the same approach: it is one business to start working with Maple having experienced only common programming languages, and quite another – having become a skilled hand at Mathcad. This is the clue to the article. While on the subject of the mathematical program Maple V the author compares it with Mathcad and BASIC.
Mathcad symbolic mathematics is imported from the Maple package. This is why a symbolic solution in Mathcad frequently results in an answer clear to a Maple user only, and the author makes an attempt to describe ideology and structure of Maple.
At first there was a Word...
The beginning of the Gospel by John proves the primacy of a Word. And here is the beginning of the «gospel» by Waterloo Maple, Inc. – the description of the Maple package: «Maple V is Symbolic Computation System or Computer Algebra System». A Symbol (an expression, an equation, a function etc.) rather than a Number is hereby declared to hold the dominating position in Maple. Designers immediately specify Maple to be mathematical, rather than computing mathematics software. Definitions of science disciplines quite often comprise a certain defectiveness which is nicely illustrated by a hypothetical dialogue in Shabolovka: «Daddy, who has constructed this tower?» – «Engineer Shuhov.» – «Is he an engineer like our mum?» – «No, sonny, our mum is a senior engineer». From the very outset the Maple package has been designed for symbolic transformations. Maple users operate exclusively with symbols and very rarely and, one might say, very reluctantly «come down» to numbers when, for example, a differential equation fails to be solved analytically and one has to resort to numerical methods.
The Mathcad package has been initially designed for numerical solutions of mathematical tasks (1988). Symbolic mathematics tools were integrated in Mathcad not long ago (in 1994 – the fourth version). The ten years' history of the Mathcad package resembles a centuries-old evolution of mathematics itself. For a long time a number (arithmetic, geometry) has prevailed in mathematics and a symbol (algebra, mathematical analysis) has appeared just on the threshold of the new history. But many Mathcad users still consider symbolic mathematics as a commercial trick serving for auxiliary and demonstration functions only.
Maple is considered to be university computer mathematics while Mathcad is mathematics of technical high schools. This fact is due to not only that the first package relies on symbols and the second one – on numbers. Solution of mathematical tasks in Maple requires a user both to be able to operate one or other built-in function and to know properly solution methods introduced into this function: many built-in Maple functions demand an argument specifying a solution method. Everyone acquainted with mathematical packages knows what a root of equation is and what function (procedure) allows the root to be discovered, but the methods applied at solution of the equation still remain a deep dark secret for many users.
Women living in metropolises are, perhaps, higher educated; but skills of society smooth a personality away soon and make souls just as monotonous as head-dresses.
A.S. Pushkin. Young lady-peasant.
Pushkin says that there is neither real beauty nor real grandeur without individuality. Individuality of software packages emerges not only in a set of mathematical tools (a soul) but also in an interface (an appearance). Speaking of the most popular Mathcad and Maple versions (there are versions designed for various platforms – DOS, Windows, Mac, UNIX…) one might paraphrase Pushkin and say that the Windows environment allows, perhaps, superior compatibility facilities for connection with other applications and peripherals, but the Windows ideology smoothes programs away soon and makes them just as monotonous as their interface.
The «soul» of Maple is descended from Fortran or rather from plentiful mathematical libraries designed for a long life of this language. Fortran is the very language having provided the first elements of computer algebra: a programmer, for example, inputs such a line a = (x**2 - y **2) / (x - y), but a program compiles quite another, simplified line – a = x + y. The interface of Maple in its turn is nothing more than the mode of the direct execution of BASIC operators.
Everybody has heard of the three programming revolutions: structural, object-oriented and visual. But a few people remember that the real and the only, in some sense, revolution in programming was broken out by the BASIC-interpreter. In the «pre-revolutionary» epoch a program firstly had to be written down, compiled into machine codes and only afterwards the result was possible to be obtained. A user did not observe subproducts and was not able to interfere a computing process in time. It was the reason for most listings to be thrown straight into a wastebasket, and the BASIC language introduced a new technology. Having opened any old manual of this language, one may read: «If a line being inputted starts with a number, it becomes the line of a program being created (edited). If a line lacks for a number, operators of the line are being executed directly on pressing Enter». Fig. 1 presents the protocol of the direct execution of operators in the GW-BASIC environment, which is incorporated into MS DOS 3.x. The example is easy but displays much.
The protocol demonstrates the initial three to be firstly manipulated by direct means (degrees, tangents) and then by inverse ones (radicals, arctangents). In this connection the variable e takes the value of a non-three (three and a little more).
A text expression input mode is substituted with a graphic one in Mathcad (see Fig. 2). Besides, the appropriation sign «=» is substituted with the sign «:=», and the operator print is possible through the Mathcad-operator «=». But the matter essence is not changed so far: the three suffers the same dismal fate as in Fig. 1.
The Maple package is, roughly speaking, a BASIC-interpreter supplied with over 2500 built-in functions for solution of various mathematical problems: search of the roots of equations and systems, plotting graphs, optimization, linear algebra, integral transformations, linear programming, statistics, tensor analysis, complex variable function analysis, graph theory, combinatorial analysis and more.
The basic (and for many users – the only one) operating mode of Maple – is the direct execution of line commands. As in the BASIC environment a text mode is used for input of line commands and a column separates operators. By default input lines in Maple are displayed in red color, a graphic response of the system is displayed in blue, and user comments are colored black. The GW-BASIC language presented no color accentuation (for the first time this technique was applied in Quick Pascal, and at present almost all programs are being colored). The availability of an interpreter to «listen» to the next user phrase (while a user has been gradually getting a programmer no more) was marked by an exclamation Ok similar to the radio operator word «contact». And here is an appearance of the «world-tour» of the three in the Maple environment (Fig. 3).
Looking at Figures 1-3 one may contend that Maple – is BASIC with an altered ideology (the data storage and processing structure); and Mathcad – is BASIC with an altered interface. In short, Maple – is Basic today.
The Maple interface is designed for the users having got their hands in conventional programming requiring rather sophisticated formulae to be inputted under the text mode. Such people reckon as a pure profanation input of a square root and other mathematical operations by means of pushing corresponding buttons at the toolbars (the Mathcad technique). And a graphic editing of an earlier entered formula often becomes to them an unsolvable problem at all. But those ones, having from the cradle enjoyed the fruits of the easiness and comfort allowed by Mathcad at input of formulae in their natural «skyscraper» notation, turn up their noses at all kinds of various sqrt, int, diff (roots, integrals, differentials – the Maple technique) etc. The Mathcad interface is intended for these very users and, probably, it is one of the advantages Mathcad enjoys wide popularity. The fifth Maple version allows input of function text headings through pressing of corresponding buttons – see Fig. 3.
Don’t rush to carry out an order: it is very likely to be canceled.
An army and business folklore
The above-stated triple-lingua BASIC-Mathcad-Maple does not simply illustrate the interface features of these environments, but also broaches more serious aspects. The Achilles' heel of numerical methods is an error of calculations. It happens very frequently that even the paltriest error garbles calculations and may stultify the value of a result. Symbolic computer mathematics carries an initial quantity through the transformation thicket in its primeval condition: the initial three is kept in all skyscraper formulae as in a shell in Fig. 3. «Don’t rush to carry out an order: it is very likely to be canceled» – the bureaucratic rule engenders not only a red tape, but also absorbs unreasonable instructions of authorities and user applications. Maple does not rush to transform a number into a conventional form (a real number with a floating point, for example) and is not entrapped like in Fig. 1 and Fig. 2 (disappearance of the three). The Maple environment presents the function evalf allowing the value of a variable up to 500 000 signs length. But the three is absolutely correctly and promptly extracted («a shell is chipped out») from the expression stored at the variable e by means of the first and somewhat the principal function of symbolic mathematics – simplify. In a word: don’t rush to calculate – it is very likely to be not necessary.
Protocols in Figures 1 and 2 represent in effect a computer realization of the childish game called a broken phone (misinterpretation). The player a thinks of a word and whispers it to the player b with negligible distortions, the player b whispers the word to the player c and so on. The word is successively passed on and reaches the last player who utters a word he heard from his neighbor. The player a utters the initial word and a burst of laughter – a concomitant of any game – rings out. But a computer garbling of numbers evokes not laughter but tears. The significance of the transition from numbers to symbols at a computer solution of mathematical problems can be equated with the transition from the analogue to the digital technology of audio and video recording.
A number stored in a symbolic form enables not only solution of the precision problem, but also allows economy of a computer memory: for example, the square root of three in a symbolic form (Ö3) keeps 1,73… (ad infinitum). A programmer operating with Maple should not rack his brains over a variable type selection (single, double and other precision). Speaking of the extra-precision enabled by «long» variable types one should not forget that the nature does not stand not only sharp corners but also a redundancy. If a solution «collapses», this testifies not only to defects in a computing procedure, but also to an incorrect initial model. There is another dialogue, but happening in a museum rather than in Shabolovka. Guide: «This exhibit is one billion and twenty years old». – Visitor: «Whence is such an accuracy?!» – Guide: «When I got fixed in a job, I was told that this exhibit was a billion years old, and since that twenty years have passed.» The author also suffers a similar redundant pedantry: in some figures the operator «=» displays all 15 number signs, although three or four will suffice.
Maple variables can keep (of course, symbolically) whatever one likes: constants, expressions, functions, equalities, inequalities, graphs, geometrical images etc. And the variables themselves are aggregated in sequences, arrays, lists, sets and tables. A list is possible to be an array element, an array is possible to be a list element and so on. A user is able to create rather complicated mathematical abstractions arranging various structures and creating new ones, being confined just within his imagination and a computer memory. According to the well-known statement of Wirth: the program – is the algorithm plus the data structure. Speaking of Maple, it is possible to note that the protocol of a task solution – is the well designed symbolic data structure, having been filtered through a sieve of functions and commands. A similar to FORTRAN language is built into Maple allowing complicated algorithms, but a pure programming is used only in particular cases – both Maple and Mathcad were designed as programming aids free from programming (at that time «operation at a computer» and «programming» were almost synonyms). One has to resort to programming both in Maple and Mathcad in the cases that built-in facilities fall short of a task solution.
The protocol in Fig. 4 almost faithfully copies the protocol in Fig. 3 except number 77 is replaced by 2 and 99 is replaced by 3 in formulas. The task was simplified, but nevertheless the initial three is irretrievably lost. A complex number scrambled out instead, not resembling the three at all. Errors in computing mathematics garble numbers slightly (see Fig. 1 and Fig. 2), while errors in symbolic mathematics are fatal in most cases. It is more common to discuss not errors, but a mutual misunderstanding between a user and a program. The essence of Fig. 4 is that the arctangent is not quite an inverse tangent function, and the square root of a number is not quite a number to the power 1/2. We repeat once more that it is best not to apply to Maple without a strong mathematical basis.
At one time, when personal computers were a novelty for us, psychologists tried to observe men operate at a display. They made attempts to observe and to draw conclusions, which were, as a rule, of two sorts: a psychologist was either stating a well-known truth or was uttering an obvious nonsense. The clever psychologist was settling on the third variant – he was silent. It is possible to note something like that studying operation of symbolic mathematics. One may devise a test to «crack» it and to force a program to yield an «incorrect» answer (Mathcad and BASIC solve the task in Fig. 4 «correctly»). Analytic transformations being not so difficult are carried out manually and computers do not introduce something outstanding. But a usual (alas) computer reaction to complicated problems – is silence.
Translation by I.Repkin.
Please send your corrections on spelling and grammar of the text by e-mail: Pat33@mail.ru.
Sincerely yours, Ilya Repkin.
 The design of the company Waterloo Maple, Inc., 450 Phillip Street, Waterloo, ON, Canada, N2L 5J2, ph.: 519-747-23, fax: 519-747-5284, http://www.maplesoft.com. The character V in the title of the package means the Latin letter V (Victory). We shall omit it subsequently.
 On the other hand, the «real» branches of science do not fear the adjective «entertaining»: entertaining mathematics, entertaining physics etc. But! How would you like this – «Entertaining scientific communism»?..OK, we shall not kick a dying lion – «Entertaining astrology».
 This is the street in Moscow where the first TV tower stays.
 The development of the Mathcad package for Apple Macintosh computers had been finished at the fifth version, and the last version for DOS was the version 2.51.
 It was a peculiar protest against the domination of numbers in Computer Science.
 A long time ago the author wrote the article on the principles of a program coloring and sent it to the magazine «Microprocessor facilities and systems» (it was the only magazine at that time to publish articles devoted to personal computers). The article fell into the hands of … a color-blind reviewer.
 A comparison, of course, is rather ridiculous! Let’s recollect another slogan: «Stalin – is Lenin today!» The author had been stuffed with a various ideological mess, which arises from memory depths at the most inappropriate moments. Here is another conceptually consistent statement: «Mathcad – is a materialistic direction of the BASIC development, and Maple – is an idealistic one».
 The principle is possible to be modified as applied to computer operations: don’t rush to study programming languages – they are very likely to be not necessary. Mathcad and Maple allow rather complicated tasks to be solved without a conventional algorithm coding.