If the reader will correct translation and will send the improved text to the author (ochkov@twt.mpei.ac.ru), the author will tell a thank.

The story of the masterpiece
(Mathcad and nonstandard graphics)

V.Ochkov http://twt.mpei.ac.ru/ochkov  (Russian version of the article) (Another articles of V.Ochkov)

The word «masterpiece» in the title of this article should be, certainly, placed in quotes. In fact, the article title – is nothing else but the name of the TV-series presenting stories of famous canvases, kept in the Tretyakoff Gallery (Moscow – www.tretyakov.ru), in the Hermitage (St-Petersburg – www.hermitage.museum.ru), in the Russian Museum (St-Petersburg – www.rusmuseum.ru) and in other museums of Russia. Our «masterpiece» is also kept in the gallery, but this is the virtual gallery – the gallery of uncommon three-dimensional graphics enabled by Mathcad (Fig. 1).

Fig. 1

The Internet address of the gallery is: http://www.mathsoft.com/mathcad/library/3Dplots. And the story of the «masterpiece» (it is displayed at the lower right of Fig. 1 and is called lace.mcd) is given below.

One of the most traditional tasks to be solved in the Mathcad environment is searching of the algebraic equation roots. Various physical, chemical and other «subject» tasks are reduced to the problem of this kind.

Fig. 2

Figure 2 illustrates solution of a similar task by means of the Mathcad symbolic mathematics[1] allowing determination of all 24 roots of the set of two nonlinear algebraic equations:

x2 × y2 _ ×  x3 ×  y3 _ 7=0

(x2 + y2)2 _ 7(x2 _ y2)=0

Four of the obtained roots are real (the 1-st, the 6-th, the 19-th and the 22-nd from the top[2]), and the remaining ones – are imaginary (complex). We are lucky, so to say, with the solution displayed in Fig. 2: if any equation of the system is slightly complicated the Mathcad symbolic mathematics fails to solve the task. Operator solve, used at solution of the Fig. 2 task, – is a maximalist of a sort for it returns either all solutions of the system or none. But a user at his computer needs, as a rule, only a single real root from the range indicated by himself.

Fig. 3

Real roots of our system are searched in the example shown in Figure 3 by means of not symbolic, but calculus mathematics of Mathcad: the built-in function Find returns the values of its arguments (x and y) converting system equations (they are written under the keyword Given) into identities. More precisely the argument values returned by the function Find make deviation of the first and the second member of equations less (in absolute value) than the value of the built-in variable TOL (TOLerance, – by default it is equal to 0.001): the term «calculus mathematics» has a synonym - «approximate calculus mathematics». It is implied that symbolic (analytical) mathematics presented in the task solution in Fig.2 – is mathematics of absolutely precise calculations. Because of this fact, and also owing to that symbolic mathematics always seeks for all solutions, it appears powerless in the face of more or less complicated problem. But, we repeat it again, in most cases a user does not need absolutely all absolutely precise[3] answers (Fig. 2). He is usually satisfied with approximate values of certain roots (Fig. 3).

The God loves trinity. Complete solution of a task in the Mathcad environment should include not only symbolic[4] (Fig. 2) and not only approximate (Fig. 3) solution, but also graphical solution, which one visualizes and also verifies the solution accuracy. To solve our task graphically – means to plot two curves on the Cartesian graph, and points of intersection of these curves appear to be real roots of the system. But the trouble is that it is not always possible to reduce a system (see the foregoing example) to the form suitable for the graph construction:

y1(x) := f1(x)

y2(x) := f2(x)

Thus it is required to solve the equation f1(x, y) = 0 and f2(x, y) = 0 in x, that is rather sophisticated problem in itself and is often not solvable at all. But if an initial equation is solvable, there may be plenty of solutions – y11(x), y12(x), … y1N(x)y21(x), … y21(x), y22(x), … y2N(x), each of them requiring for an individual curve on the diagram. We have got a certain Gordian knot, not to be untied by us: we will simply … cut it down[5].

Fig. 4


Plot of the implicit function f(x,y)=0 on the MAS (Mathcad without Mathcad)


Figure 4 demonstrates a universal technique for graphical solution of the system of two algebraic equations: the surface x – y is scanned (the x and y coordinates are sorted out by two cycles for) and there are memorized the points where the function f1 or (see the operator V – the logic addition operator OR) f2 is close to zero. As our Mathcad-program is being run, two vectors y(x)[6] and x of equal depth are generated in Fig.4. The vector elements keep graphical solution of our task: intersections of curves on the graph (at the center there is plotted famous Bernoulli lemniscate[7]) – are the roots of the system under consideration. The root values are possible to be defined more precisely by addressing to Fig. 2 and Fig. 3, or by changing the values of the variables x1, x2, y1 and y2 (zooming of the graph).

And now we are getting to the above-mentioned «masterpiece» exhibited at the gallery of MathSoft, Inc. (Fig. 1).

As the reader understands, the graph construction technique presented in Fig. 4 is both suitable for a system and for a single equation of the type f (x, y). Not long ago the author (of the article and of the Gordian knot cut down technique, displayed in Fig.4) was caught with a problem «laid out» at the Collaboratory forum (see the article «Mathcad and Internet, or the Network collective farm», ComputerPress (www.compress.ru), 3’2000 – http://twt.mpei.ac.ru/ochkov/Collab/Collab.htm): a Mathcad user asked to help him to plot the graph of equation

sin(x × sin(x)) – cos(y × cos(y)) = 0.

The standard tools of Mathcad allow this problem only by means of construction of equal level curves (Contour Plot). The task solution – is the zero level line (f(x, y) = 0 – analogously to a coastline on a map). But the trouble is that it was impossible to construct a clear line f(x, y) = 0 of the above-mentioned specific equation – everything was like in a fog[8]: the curve was seen to be complicated, but what kind of curve it was, was not clear.

Fig. 5

Figure 5 exhibits our program of the x - y plane scanning from Fig. 4 but it is a little more complicated (duplicated): scanning is carried out not only «vertically» (for x … for y …– as in Fig. 4), but also «horizontally» (for y … for x …) in order to enhance the image sharpness, for the graph in Fig. 4 is broken into separate points at a small «rise» of the y axe.

The program in Fig. 5 inches along[9]Fig. 6 and Fig. 7 display clear graphs of our function tatting into a lace. Our pictorial canvas is exhibited at the MathSoft, Inc gallery just by this very name (lace). We have got the square lace shawl. We pose not a Cartesian but a polar graph to be constructed by the reader to obtain a round lace napkin. Another commission – is to search for equations f (x, y) with a nonstandard graphics appearance.

Fig. 6

Fig. 7

In a fig. 8 it is possible to see the polar diagrams of our function, also curves plaited in the lace – in lacy a napkin for a round table.

Fig. 1


The technique of construction of the diagrams stated above, after small completion (see program in a fig. PS 1) suits graphic display not only equations, but also inequalities.

Ðèñ. PS 1. The program for construction of embroidery Richelieu – graphic display of an inequality

The fine art is impossible without colours. The author bright colours variable in the program in a pic. PS 1:

More in detail idea of colour in the Mathcad-programs the author has stated in a forum Collaboratory (forum è article).

If the diagram of function can be compared with lace, the diagram of an inequality is similar to other sample of national creativity - on embroidery Richelieu. More correctly, but it is less beautiful to tell, not «on embroidery», and «on a clipping » – on a fabric do (make) "art" holes and overstitch of edge (see fig. PS 2). In childhood of a house of the author surrounded such napkins – them the mum covered everything, that it is possible to cover: pillows on a bed, cases and even the TV set (ÊÂÍ-49).

Ðèñ. PS 2. Graphic display of an inequality – embroidery Richelieu

The polar display of the diagram in a fig. PS 2 is too "beautiful" – see fig. PS 3.

Ðèñ. PS 3. One more lacy a round napkin

I offer the readers «the interesting task» – search of the equations of a kind f (x,   y)   =  0, on which it is possible to construct «interesting figures».

PS3 The Lace-solution in Maple

[1] The Mathcad tool «Symbolic mathematics» has the more precise name – mathematics of analytical conversions.

[2] The symbolic mathematics operator Solve returns an answer in the form of a matrix with a number of lines equal to a number of the system roots and with a number of columns equal to a number of the system unknowns. Operator float stimulates Mathcad to return not an analytical answer (it is often very intricate and appears useless for both mind and heart) but a decimal fraction with a floating point. The key 5 to the right of the word float presents a number of significant figures to be displayed in the answer. There are displayed 20 figures without the key, and the maximum possible amount of figures – is 250. (Command Solve from the Symbolic menu allows 4000 figures, but it is suitable only for single equations rather than for systems).

[3] There are displayed only five symbols in the answer of Fig. 2 (the key of the keyword float). By default (without the word float) there are displayed 20 signs. The maximum possible number of significant figures is – 250. There is also allowable analytical answer, rather than an answer in the form of a number with a floating point.

[4] Good rule: it is best to start the task solution with the analytical analysis.

[5] According to the ancient Greek legend, the Gordian knot is the tangled knot the Phrigyan king Gordy had tied the yoke to the cart pole. The oracle prophecy had said that the one to untie the knot would have got the domination over the world. The legend tells, that Alexander Macedonian in 334 year B.C. in reply to untie the knot had cut it down by his sword. Hence it follows that «to cut the knot» – means to get a prompt and courageous solution of an intricate and sophisticated problem. The reader will judge how much «prompt and courageous» and ,chiefly, effective and correct is our graphical solution of the f(x, y) equation.

[6] y(x) – is not the variable name, but the function name. But, the reader, don’t trust your eyes: the Mathcad environment allows intolerable variable names with brackets. There exists a biological phenomenon called «mimicry», when a living creature pretends to be not a thing it really is! A mantis, for example, shams to be a bough. Our variable y(x), or more correctly, not the variable but the vector, takes the form of the function (mimicries).

[7] Lemniscate – means «twined in bands».

[8] By the way, the fog – is a standard technique for rise of the three-dimensional graph voluminosity. Thus, Fig. 1 presents another «masterpiece» of the author – the bridge in a fog. The two additional tools are the perspective and the lightning. The perspective along with the fog was applied at the bridge construction (bridge.mcd): the roadway floor converges in the distance (Mark Twain has said, that many composite German words are so long, that should be written down following the perspective law). The graph lighting is also presented in seven «masterpieces» of our virtual gallery (Fig. 1): linked.mcd (cohesion of two tore-bagels), klein.mcd (one-sided bottle – the volumetric analog of the Mobius band), sphere lighting (illuminated sphere – one cannot do here without lighting for the ball will turn into a flat pancake otherwise), knots (roteight.mcd and knots.mcd – it is interesting, whether it is possible to visualize the Gordian knot mentioned in the article) and orbital.mcd (it is not even a picture, but animation of the Shuttle flight around the Earth).

[9] Fig. 5 illustrates the possibility of the undocumented built-in Mathcad function time: it allows the calculating time to be fixed. In our example the calculating time is the time of generation of two vectors (they consist of 28828 elements each) – the time was equal to 124 seconds (Pentium II, 233 MHz). The programs shown in Fig. 4 and Fig. 5 are possible to be optimized in the speed of operation. In particular, the program operation is strongly braked by the fact that the value of the function under analysis is calculated twice (at the point x, y and at the point x, y+dy: from above and from below of the probable root), though this operation can be performed only once a time by means of the previous calculation result. Changing the program will speed up its operation but will make it more complicated for the reader to understand it.