Mathcad 2001 – What's New?

Forward

1.      Tools palettes and menus

2.      New machine arithmetic

3.      Singularity checking

4.      New functions

4.1    Coordinate system for graphs

4.2    New fitting function

4.3    Wave functions for work with files

4.4    New histogram building function

5.      New features of the interface

6.      Mathcad and the Internet

6.1    Hypertext links to specific formulas

6.2    Saving Mathcad documents in the MathML format

7.      NEWS FROM SOFTLINE (www.softline.ru)

Forward

This article is a byproduct of the author's work on two books from the series "Mathcad for Professionals" [1] – "Advice for Mathcad Users" and "Physical Dimensions in Mathcad". In the midst of the author’s work on these books, a new version of Mathcad came out – Mathcad 2001. This was not the final commercial version, but a beta-version [2]. This new development required that some corrections be made in the abovementioned books. At first, however, the author had to study the new features of Mathcad 2001, which prompted the writing of this article.

So, what's new?!

1. Tool Palettes and Menus

Any acquaintance with Mathcad begins, naturally, with the menu and with the palettes of the more popular menu commands, which appear on the screen upon loading the package and entering the Mathcad 2001 environment – see Fig. 1.

[Figure 1 – Mathcad 2001 tools panel]

There is only one new feature here, only one change – to the right of the New Document button there is now a button that invokes a pull-down menu of templates. In earlier versions (Mathcad 7, 8, 2000), this list was only accessible using the New… command from the File menu.

As concerns the tool palettes, the only change was with the Calculator palette. On Fig. 1 two versions of this palette are shown – the Mathcad 2000 version and the Mathcad 2001 version. The following is a list of some of the new features of the Calculator palette:

[Fig. 1a. User Defined division operators.]

The symbols "/" and ":" can be entered into the worksheet as division operators. To do this, use [Shift+Alt+k] to disable the regular functions of those two keystrokes as macros for entering the division operator and the assignment operator, respectively. Having done this, the cursor will change from blue to red, indicating that we are now in the «literal» mode for entering special symbols [3]. Pressing [Shift+Alt+k] again toggles the cursor back to blue.

 

2. New Machine Arithmetic

This key new feature of Mathcad is not reflected outwardly in the menu or on the toolbars and palettes (see Fig. 1), but it can significantly influence the way you work in the Mathcad environment. Mathcad has an interpretive, rather than compiler-based programming environment. Because of this, computing even some rather small worksheets (especially those containing certain advanced functions – for example, odesolve, which solves the boundary problem in the field of differential equations) can take a pretty long time. In the Mathcad 2001 environment, calculation is “higher speed” by default – see the radio button in the Performance Preference frame of the Math Options dialog box, which can be displayed using the Options… command in the Math menu (Fig. 2):

[Figure 2. New calculation options in the Mathcad 2001 environment]

Fig. 2 shows a comparison of the regular and higher speed (“forced”) arithmetic in Mathcad on a simple problem – the summation of natural numbers from one to one million. The outputs of both the regular and the higher speed calculation were the same (500000500000), as expected, but the difference in the speed of the calculation was significant – the Mathcad higher speed calculation works almost an order of magnitude faster (2.26 vs. 21.42 seconds). In the tests displayed in Fig. 2, an undocumented Mathcad function that returns the system busy time in seconds was used. This output does not interest us in and of itself [6], but the difference in the two times (Dt) can significantly help in conducting time tests of different programs.

Figure 2 also shows another, older, option for speeding up calculations – "Optimize expression before calculating". If this option is selected, calculation is preceded by an analysis and simplification of the expression using Mathcad's symbolic math processor – that is, Maple. In our case, a simplification of the sum gives an expression whose calculation takes a fraction of a second – see Fig. 2a.

[Figure 2a. Optimization of calculations using symbolic evaluation]

To the right of the optimized formula appears a red six-sided asterisk. In Russia, it is said that this is an allusion to the idea that the best mathematicians are Soviet jews (a joke: What is an American university? It is a place where former Soviet jews teach math to Chinese students).

But far from all problems can be solved using symbolic math. Moreover, an analytical answer still has to be completed using numerical methods (computing formulas, drawing graphs, searching for the roots of equations, etc.). In such situations Mathcad's "forced" arithmetic can come in very useful. The following advice may also come in useful: before a series of computations using the "forced" arithmetic, it is worthwhile to compute one of the points in normal mode, and compare the results with those from the higher speed calculation.

[Figure 2a. Error of higher speed calculation due to optimization of numerical calculations]

Mathcad's accelerated arithmetic can be turned off – see the Backward Compatibility button. This option realizes the well-known principle of "Forget opulence – just try to stay alive" {Translator’s note: Yeah, that’s a poor translation. I don’t know the corresponding English proverb.}. Mathcad's developers left the regular "cruising" calculation speed for those who are concerned primarily with the result, not the speed [7]. In addition, the new tool often causes errors. One such error is shown in Fig. 2b: variables entered using the global assignment operator behave inadequately during multiplication, when the "Optimize" and "High speed calculation" options are both enabled.

 

3. Singularity Checking

In slang, this kind of check is often called, pardon the expression, a "check for lousiness". Experienced users of not only Mathcad, but also other computational systems, all have a set of examples that "put these computational systems in their place". No matter how cleverly and quickly a system performs calculations, such a user might say, I have some examples that show once again that man (that is, me) is still the king not only of living nature, but of non-living nature as well. Returning to optimization of calculations using the analytic transformation shown in Fig. 2a, it can be shown that such an optimization can slow down calculations instead of speeding them up. One example of this is a definite integral whose upper and lower bounds are equal. A person, as well as Mathcad's numerical math, will immediately figure out that such an integral is equal to zero. Mathcad's symbolic math, on the other hand, will first search long and hard for an antiderivative expression, and only after that, substituting the limits, will figure out that it really should not have been looking for any such expression. This example shows the peculiarities and differences of the way that a human performs calculations and the way that a computer does so. For an experienced mathematician, a quick glance would often suffice to solve a problem – to understand, for example, that an equation has no roots, that a given matrix is singular, etc. Users of mathematical packages often use such examples to poke fun at developers, and reproach them.

Computer users have a singular matrix literally right under their noses – the buttons on the numerical keypad of a standard computer keyboard comprise such a matrix. Mathcad users often input this matrix to the program, asking it to compute the inverse matrix – see the first operator in Fig. 3.

[Figure 3. Working with a singular matrix]

Regular Mathcad will shamefully compute the matrix inverse to the singular one [8]. In the Mathcad 2001 environment, this operation can be preceded by a check for singularity – "Use strict singularity checking for matrices" (see Fig. 3). If this is done, the computation of an inverse matrix will be interrupted by an error message (see last operator in Fig. 3 [9]). As it happens, an analogous error message appears in old versions of Mathcad when computing the inverse of a matrix using symbolic math. Mathcad's symbolic math, or rather Maple, also makes mistakes – see Fig. 3a.

[Figure 3a. Symbolic math error]

An analytical "check for lousiness" (again, please pardon the slang expression) can now be used with scalar calculations as well – for example, -x*lg(x) when x=0. Older versions of Mathcad evaluated this erroneously to zero, but Mathcad 2001 gives an error message: "This function is undefined at one or more of the points you specified".

All these mistakes on the part of developers of various computational systems are understandable, if not forgivable. In the Mathcad 2001 environment, for example, there still remains the following error: sin(0)/0 outputs zero as the answer, not a "Division by zero" error message. This is because, in order to speed up calculations (see part 2), a product [10] is automatically evaluated to zero, if the first multiplicand is equal to zero.

Mathcad developers, in creating computer arithmetic, have to find a balance between accuracy, errorlessness and speed, and the more practical demands, like the system's cost and deadlines. It is possible to put a perfect product on the market, whose "perfection" would be attained at the cost of a very high product cost and very slow calculation speed. Such a product may not find a customer.

The singular matrix example sheds light on a very interesting tendency in the development of computational systems: they must be able not only to solve given problems with acceptable accuracy and speed, but they must also be able to precede this by an analysis of the problem in question.

In the three examples given above, three directions of Mathcad's development are illustrated:

1.      Qualitative changes: An operator was not there, and in the new version it is there (Fig. 1).

2.      Quantitative changes: Calculations have gotten faster.

3.      Error correction or elimination of certain limitations. The third direction concerns also the fourth new feature of Mathcad 2001.

4. Units in Programs

In the Mathcad 2001 environment, the developers insist, the problem of units in loops, if-statements, and other constructs that change the natural order of computing operators, is solved.

In the environments of Mathcad 6 through Mathcad 2000 Pro [11], if-statements had to have values of the same type – either both unitless, or both with the same type of units. Any deviation from this rule would result in an error message – see the first half of Fig. 4, where the examples of the if function and the if operator are shown. In the Mathcad 2001 environment, this limitation is eliminated (see the second half of Fig. 4).

[Figure 4. If-statement with different units in Mathcad]

The situation with the return operator, which interrupts the program's operation ahead of time, is more complicated.

[Figure 5. Corrections in the operation of the return function]

Fig. 5 illustrates the creation and operation of a function which returns either the perimeter or the area of a triangle, depending on the value of the fourth argument (the first three arguments are the lengths of the triangle's sides). Mathcad 2000 Pro gets confused in these three sides of the triangle, as “in three pine trees” {Translator’s note: Another Russian expression}. Originally, the function, created by a program in the Mathcad 2000 Pro environment, returned the correct numerical answer (2.92 and 0.369, in the case of the example in Fig. 5), but incorrect units for the perimeter (m^2 instead of m). In July of 1999, patch C appeared (the second patch for Mathcad 2000 Pro), which caused the function in Fig. 5 not to give any units at all, even if the inputs had units. In the Mathcad 2001 environment, this error can be eliminated, although some flaws remain. The parameters of a loop still cannot take units of different types as arguments – see Fig. 6.

[Figure 6. Error or limitation in working with units in Mathcad loops]

This is because in the Mathcad environment, a loop chooses the value of its parameter from a vector. And a vector is a collection of elements with the same units. Figure 6 contains no physical meaning (there is a product of all seven basic SI units) but, nevertheless, the program is interrupted by an error message. The use of units for physical dimensions in programs is also difficult because programs often work with vectors and matrices, which still can only contain either values with no units, or with the same units throughout.

Fig. 6 uses an undocumented feature – the assignment of loop parameters as a list. Mathcad documentation only allows the use of a range variable or a vector here. Fig. 6a shows the possible consequences of using this undocumented method.

[Figure 6a. Peculiarities of loops in the Mathcad 2001 environment]

Fig. 6a shows a program that calculates the sum of the first seven prime numbers. The for-loop variable takes its arguments from the list (2, 3, 5, 7, 11, 13, 17) – a sequence of numbers separated by commas. In the Mathcad 2000 environment, this undocumented method worked, but in the Mathcad 2001 environment it no longer does. The list has to be replaced by a horizontal vector. But a horizontal vector is not really a vector, but a matrix with one row. Thus, it turns out that we once again use an undocumented method: the vector (2 3 5 7 11 13 17) has to be turned 90 degrees (transposed).

4. New Functions

4.1. Coordinate System for Graphs

Mathcad 2000 first introduced the option of changing the system of coordinates for 3D graphs from rectangular (Cartesian) to cylindrical or spherical. This change of coordinates is accomplished by using the radio buttons of the General tab in the dialog window for formatting 3D graphics. The author has used this feature to draw complex 3D figures ("apple" and "vase") using simple formulas – see Mathcad's 3D graphics gallery at http://www.mathsoft.com/mathcad/library/3Dplots/.

In the Mathcad 2001 environment, this transformation of the coordinates can be done not only visually, but also "mathematically", using new functions which return the coordinates of given points in the new coordinate system: sph2xyz(v), sph2xyz(r, q, f), cyl2xyz(v), cyl2xyz(r, q, f), xyz2sph(v), xyz2sph(r, q, f), xyz2cyl(v), xyz2cyl(r, q, f), pol2xy(v), pol2xy(r, q, f), xy2pol(v) and xy2pol(r, q, f).

4.2 New fitting function

Ever since version 7, if the author is not mistaken, Mathcad has had the genfit function, which can be used to solve the problem of general fitting – general in the sense that the fitting (approximating) equation can theoretically be an equation of any form with any number of required coefficients.

However, for many Mathcad users this function remains a sort of "Chinese grammar" with an unclear meaning and invocation method. The genfit function requires as its argument not only the fitting function with arguments (vector elements), but also the partial derivatives of that function for different starting coefficients. In the Mathcad 2000 environment, the genfit function was split into a number of different functions, each of which solves the approximation problem using specific functions: expfit(vx, vy, vg), lgsfit(vx, vy, vg), logfit(vx, vy, vg), pwrfit(vx, vy, vg) and sinfit(vx, vy, vg), where the fitting functions have the forms a*e^(bx)+c, a/(1+b*e^(-cx)), a*ln(x+b)+c, a*x^b+c and a*sin(x+b)+c, respectively. In Mathcad 2001 this list is augmented by the new function lnfit(x, y) (fitting function a*ln(x)+b). The operation of the lnfit(x, y) is shown in Fig. 7.

[Figure 7. Operation of the new approximation function]

One can think of a lot of different fitting functions. The author cannot remember which ones are built into Mathcad and which ones are not. But he does not need to – see Fig. 7a for a method to approximate using a function of any kind with any number of coefficients. We can advise MathSoft not to develop new specific functions for approximation, but to develop and build into Mathcad a universal tool for approximation, such as the one shown in Fig. 7a.

[Figure 7a. Universal approximation using the Minimize function]

Mathcad 2001 has a few more new functions. The author does not analyze them, but only lists them.

4.3 Wave functions for working with files

READWAV("F"), WRITEWAV("F", s, b) and GETWAVEINFO("F")

4.4 New histogram building function

Histogram(n, y)

5. New Features of the Interface

Since the author was working with the beta version of Mathcad rather than with the final version, he could not evaluate the new features of Mathcad 2001 regarding the organization of the new user interface that allows the user to enter standard scripting constructs into a Mathcad worksheet (Fig. 8).

[Figure 8. New elements of the Mathcad 2001 interface]

6. Mathcad and the Internet

6.1 Hypertext links to specific formulas

This feature appeared initially in the latest version of Mathcad 2000 – Mathcad operators can be associated with a tag, which can subsequently be linked to – see Fig. 9.

[Figure 9. Tag for Mathcad operators]

 

6.2 Saving Mathcad worksheets in the MathML format

Mathcad versions 6 through 2000 had problems with publishing solutions on the Internet – HTML displayed formulas as images. In the Mathcad 2001 environment, this problem is solved – see Fig. 10.

[Figure 10. New options for saving Mathcad worksheets]

MathML is a markup language based on XML (Extensible Markup Language), which is built specifically for generating mathematical formulas. In the next few years, XML will likely replace HTML. The first XML standards appeared last year. Some relevant information is at www.w3.org, or http://citforum.indi.ru/internet/xml/links.shtml.

Mathcad 2001 has many other features which the author did not get a chance to evaluate, but which the reader can learn about through official sources.

7. News from Softline (www.softline.ru)

Mathcad 2001 is characterized by significant improvements over the previous version, including higher productivity(?) and more features.

Mathcad 2001 (version 10) is the next version of the program Mathcad for the Windows platform and will be marketed in two versions – Professional and Premium.

Main new features:

Compatibility with other popular applications is significantly improved.

 

1.      Mathcad’s new Stencil for Visio application now gives users the ability to easily include calculations and standard Mathcad math notation in Visio images, which eases the exchange of data between Mathcad and Visio.

2.      The new wizard for collecting data in real time allows users to read and send data through National Instruments analog interface boards.

3.      The ODBC (Open Database Connectivity) module allows users to get information from SQL-compatible databases, including Microsoft Access, FoxPro and other SQL-compatible databases.

4.      The updated MATLAB module allows the transfer of data and functions from MATLAB® 5 into Mathcad worksheets.

5.      An improved AutoCAD application Add-In now supports more than 10 ways to enter a Mathcad object, and also allows users to take output from DataTable cells and copy them into the exchange buffer.

 

Four modifications significantly increase the productivity(?) of Mathcad.

·        The processing of units in real time eases the use of physical values in worksheets.

·        The limitation of recursive descent in the calculation process speeds up calculations 5-20 times. Calculations are optimized, especially for iterations, summation, integration and differentiation.

·        New logical algorithms, based on dependencies of the ranges of variables, and a lot of coordination between analytical and numerical calculations.

·        Memory management is improved and processing of removable objects in worksheets.

 

New authoring mode in conjunction with newer MathML-based electronic publication features.

 

The new Mathcad 2001 Authoring Mode gives you the tools necessary for creating your own electronic books! Now you can compile and electronically display finished presentations of your Mathcad worksheets, including content, links and an index.

 

·        Link control function allows the author to easily check links, created between worksheets.

·        Index-marking function now allows to quickly create an index for users’ electronic books.

·        An improved reference function now allows references not only between worksheets, but also between areas of worksheets and between multiple documents (this function is available outside the authoring mode as well).

 

Mathcad 2001 is distinguished by excellent electronic publishing features and sets a new standard for publishing technical documents. With the launch of the new “Maverick” Web tool, which allows practically all Internet users to watch live mathematical calculations and is quickly becoming the new Internet standard, Mathcad 2001 is the only package offering publishing tools supported by “Maverick”:

·        Saving Mathcad worksheets in HTML format with MathMl support;

·        Reading HTML and MathML documents;

·        Exclusive publishing tools for creating dynamic math and dynamic math visualization, which can be viewed by most Internet users;

·        The inclusion of the latest version of IBM techexplorer Professional Edition for reading and editing MathML, TEX and Latex.

 

Tools for creating applications using Mathcad

 

New tools for developing components allow the integration of Mathcad with other applications, which brings Mathcad to a new level of expandability.

 

1.      Improved scripting objects allow developers to quickly create new modules from the programmable OLE and COM objects, and save them for reuse and dissemination. For example, one can develop user modules for integrating ActiveX objects, documents, processes, or applications into the outputs of Mathcad calculations, and share this development with colleagues. Standard script programming languages like VBScript and JScript are supported.

2.      A new developer’s toolkit (Component Software Developers Kit – SDK) allows the development of Mathcad user modules in C++. The new SDK includes an application wizard (Application Wizard for Microsoft Visual Studio) for quick creation and tuning of the framework of a new module. Complete interactive documentation, exhaustive header and library files and templates foster quick familiarization with the work and successful job completion.

3.      New user controlled elements of Mathcad allow the user to build in flags, switches, levers and other standard elements of the user interface into Mathcad worksheets. They can be used, for example, for tuning calculations and preparation of a simplified interface for inexperienced users.

4.      A new interactive developer’s reference contains all the details for creating user modules for Mathcad and using Mathcad in other applications. This powerful resource supports Component SDK, scripting, user control elements and Mathcad’s object models.

 

 

In addition

1.      A new interactive module for viewing images with tuning features (zoom/pan/crop, brightness/contrast, rotate/flip/trnaspose, etc.) and new file formats (BMP, GIF, JPG, PCX, TARGA, PGM, TIFF).

2.      New functions for transformation of coordinate systems allow the creation of different types of graphics. The following coordinate system transformations are supported:

·        From spherical to Euclidean

·        From cylindrical to Euclidean

·        From Euclidean to spherical

·        From Euclidean to cylindrical

·        From polar to Euclidean

·        From Euclidean to polar

3.      A new two-dimensional bar-graph.

4.      Histograms automatically generate bars.

5.      Additional fitting function using linear regression.

6.      Support of .wav files allows reading, recording and obtaining information about formats (filename, speed, resolution) from .wav files.

7.      New search functions allow searching for values in vectors and matrices and return the appropriate rows or columns in the same or other vectors or matrices.

8.      Support of mixed numbers for entering data and returning results.

9.      New default option for displaying(?) of the result in engineering notation.

10.  New option for setting the calculation mode, which allows comparison between Mathcad’s new high-speed calculation processor with the old one.

11.  New option for singularity checking for matrices.

12.  New menu for product update allows automatic update of Mathcad to the latest available version.

13.  Electronic user manual, reference material, templates for Mathcad 2001, and also access to Mathcad 2001 Internet resources and support.

14.  Support of Windows 2000.

 

For more information about Mathsoft and its products, visit SoftLine’s Internet site at www.softline.ru/science.

 

 

{Translator’s note: Some information about SoftLine – not really relevant.}

 

 

[1] See the forward for this series.

[2] The alpha-version is being tested by the development firm, the beta-version is sent to so-called beta-testers, and the gamma-version is the final (commercial) product, which is then “tested” by all the users. The results of these tests are manifested in the different “patches”, which correct the program.

[3] By special symbols we mean those symbols (+, -, [space, *, /, $, @, etc.), which ever since Mathcad’s DOS version have been reserved for entering operators (arithmetic operators, summation, construction of graphs, etc.).

[4] This is not exactly true: the division operator with one in the numerator and the inverse operator can return the same result, but work using different algorithms.

[5] The dream of many Mathcad users that, unfortunately, is not realized in the 2001 environment, is the ability to compile a Mathcad document into a .exe file, for example, which the user would be able to launch outside the Mathcad environment.

[6] The author sometimes uses this time to evaluate the work of students – to determine if he solved the problem himself or copied it from a friend.

[7] We can suppose that the “forced” arithmetic is not quite fully tested, and thus sometimes has problems.

[8] This concerns numerical calculation.

[9] Here we used a “telephone” singular matrix rather than a “computer” one. It’s a mystery why computer people and phone people cannot decide on a single format. This is especially strange considering that soon the mobile phone will be hardly different from a computer.

[10] Mathcad arithmetic does not “know” how to divide: division is done by multiplication of the numerator by the inverse of the denominator.

[11] Adding “Pro” (Professional) means that programming is enabled.