mathcad for the engineer

Share this on social media:

company: 

Ray Girvan reviews the XP-compliant Mathcad 2001i which has an increased focus on engineering

In the leader for the March/April issue of Scientific Computing World, Tom Wilkie commented on artefacts of the news-gathering process: why, for instance, software reviews in Scientific Computing World are generally positive. A similar phenomenon is that we tend to look for an 'angle' - in the case of scientific software, the latest additions or newsworthy corporate events - and sometimes forget that not everyone knows the basics of a story.

 

Therefore, I'm following up the recent 'Useful additions' review, which concentrated on certain specifics of Mathcad 2001i and its background, with a more general look at this popular mathematical package from MathSoft Engineering & Education Inc. The new company name is the result of a schism in the original Math- Soft in early 2001. The Seattle division became Insightful Corporation, specialising in S-Plus and statistical services, while the Cambridge, Massachusetts, engineering and education division became a private company to market Mathcad, Axum and the school-level StudyWorks! range.

 

As if this were not complication enough, the scheduled launch of Mathcad 2001i coincided with the release of the new Windows XP operating system, and there's a certain synchronicity between their backgrounds. Microsoft's aim of XP unifying the small-user 95/98/Me and the corporate NT/2000 operating systems was achieved at the price of compatibility problems with PCs built before 2000. MathSoft (for short) has similarly focused its efforts on this single release that runs only on post-98 Windows systems, furthermore dropping support of Mathcad 7 and older. MathSoft, though, at least has the excuse of commercial pressure, as a new standalone company, to concentrate on profitable activities.

 

Fortunately, these changes haven't affected the central nature of Mathcad's 'pencil-andpaper' interface: a free-form page of mathematics, text graphs, and other content. A page-based format isn't unique; for instance, MacKichan Software's Scientific Workplace integrates a math engine with a powerful LaTeX editor. But Mathcad uses an accessible WYSIWYG approach, combining the functions of a quality word processor with mathematics handling in more or less conventional notation at all stages, from input to publication. I say 'more or less conventional' because there are small but crucial differences to be learned. For instance, handwritten maths uses the same '=' sign in different contexts, but Mathcad needs explicit choice of symbol for various kinds of equality (e.g. evaluate numerically, define, define globally, and Boolean equals).

 

The basic Mathcad element is the 'region', an active area that can be placed anywhere on the worksheet. At a simplest, a region is opened just by typing anything at the red '+' prompt, when Mathcad parses the input to decide if it's text or mathematics. Clicking outside a region causes its evaluation and also that of any following derived regions. It takes a little practice to get used to the special Lshaped cursors for equation entry, but this is simplified by floating toolbars for elementary functions, special symbols such as Greek letters and Boolean operators and equation elements. Where necessary, these contain empty placeholders to fill in, such as the content and limits of an integral.

 

The region system extends to other elements, such as the plot types - XY, polar, surface, contour, 3D bar, 3D scatter, and vector field - which similarly launch empty graphs with prompts for the axis variables. In ordi-nary input, Mathcad uses the simple programming construct of a 'range variable' (typing x:=1;4 fills an array, then x^2= prints a table with elements 1,4,9,16) but userdefined functions can be programmed in more depth with procedural elements such as for, while and if...otherwise.

 

A deal of Mathcad's power comes from MathSoft's shrewd choice of added-in technology licensed from other companies. Originally numeric-only, Mathcad has symbolic functions from a Maple engine introduced in 1994. Originally this was invoked with a maple-leaf icon, but now the only evidence of its origin is the 'MKM' (Mathcad Kernel Maple) in the small print of the credits.

 

Mathcad's graph plots are calculated and rendered using the OpenGL cross-platform code developed by Silicon Graphics. This enables workstation-style graphics manipulation, such as real-time rotation and zoom of 3D plots just by dragging the mouse over the image, along with detailed control of variables such as light sources, reflectivity, colour palette, and 'fog' for perspective.

 

I have to conclude that on the mathematical front, Mathcad 2001i isn't especially different from 2001. The changes are useful but not radical: a choice of computational engine modes between a faster one inherited from v2001 and one backward-compatible with v2000 (more lax in areas such as matrix singularity checking); two new stiff ODE solvers, Radau and radau; new solvers for ODE systems with optional algebraic constraints; and others such as the choice of 2D plot gridline colour, and labels on 3D plot axes.

 

For me, the more interesting updates lie in the area of connectivity, which is particularly fundamental to Mathcad. The entry-level Professional edition I reviewed comes with IBM techexplorer (a MathML Web browser add-in), Autodesk's VoloView Express (which reads AutoCAD files), and cut-down limited editions of Visual Solutions' VisSim block-diagram simulator and Intergraph's 2D CAD package, SmartSketch. Alternatives - both with the same core Mathcad - are the Academic edition, with a full-featured VisSim; and the Premium, with the full VisSim and SmartSketch as well as MathSoft's own Axum graphing package. These third-party products aren't just bonus value-added software, but the result of long-standing bundling agreements that now amount to a symbiosis. The necessary separate installation is tedious, but the results are worth it for the power added seamlessly to Mathcad, as its worksheets can include these programs as Windows OLE (Object Linking and Embedding) objects. VisSim, for instance, complements Mathcad in the same way Simulink complements Matlab, and is faster thanMathSoft's own block diagram simulator, MathConnex.

 

Some special OLE objects such as Excel and SmartSketch work as 'components' that exchange data dynamically with Mathcad. An example included is the Smart Sketch drawing of a mechanical excavator arm whose position, a function of three boom lengths, is controlled by editing a Mathcad variable. 2001i has several new components, including an updated Data Acquisition Control rewritten for faster operation and supporting cards and boards by Measurement Computing (a.k.a. Computerboards), read/write access to Matlab 5, Excel XP and ODBC (e.g. Microsoft Access or FoxPro) databases, and a set of graphical control components for worksheets.

 

Surprisingly, MathSoft has been low-key about the last, which resembles a simpler version of Maplesoft's new Java 'Maplets' interface. They offer alternative input methods to editing a region. Devices include a text input box; a pushbutton to activate a calculation; and a check box, radio button and slider that return numerical values. The slider, for instance, could alter a variable controlling a graph (it only gives integer output, but a large enough range can be scaled to effectively simulate a continuous variable). With the combination of friendliness and error trapping to limit the input to an intended range, they have strong potential for educational and demonstration worksheets.

 

The control components have one downside: they're driven by VBScript, which comes under suspicion with 2001i's new security features. Security has been a longstanding topic in Mathcad user groups, stemming from the much-ridiculed Mathcad 8 system for locking and hiding worksheet regions: the password was plainly visible using a text editor! Even in v2001 it was still findable with a little ingenuity, but for those who need to safeguard proprietary material this loophole has now been tightened up by encrypting the whole worksheet. Other security concerns - malicious code, and the omnipresent problem of users fiddling with worksheets - have been tackled by giving graded security options for running scripted components and editing worksheets.

 

Another publicised update is 'improved Web integration'. Mathcad's ability to publish to the Web has progressed steadily from .MCD worksheets readable only by Mathcad, via plain HTML, to HTML augmented with MathML, the World Wide Web Consortium's mark-up language for machinereadable Web display of mathematics. 2001i features several updates in Mathcad's HTML implementation, one being aesthetic: the adoption of PNG (Portable Network Graphics) images as an alternative to the JPEG used to save text and graphic regions to HTML. A few tests showed this visibly fixed the murkiness due to JPEG compression artefacts around graph traces - text looks no different - at the expense of around 30 per cent increase in file size compared to the default JPEG quality setting. (PNG is the open source lossless compression format developed as a substitute for the better-known GIF, since Unisys began enforcing their patent on the underlying algorithm.) Other changes affect the output format when saving to HTML. For instance, there's the choice between a 'fixed' layout implemented as hard-to-edit DIV LAYER tags and a 'relative' one implemented as a Byzantine HTML table that's nevertheless easier to incorporate in other pages, either by hand or using the new HTML template support.

 

From a web design viewpoint (I was interested in developing recreational math pages for my own site) I think that both layouts generate unnecessarily bloated code. MathSoft all but admits this in advising that for clean conversion to HTML, the worksheet should be simplified to contain a few wellaligned vertical regions. Other inconveniences include Mathcad's insertion into tags a 'MCD' string that confuses some HTML editors; and I've never liked the wasteful rendering of text as graphics. This, in my view, overspecification of layout probably lies in Mathcad's roots in a page-oriented philosophy aimed at controlling the precise appearance. However, browsers won't see the underlying code, and the system clearly works in providing the claimed bi-directional MathML support - within limits. Any recent browser supporting IBM techexplorer can read Mathcad's MathML, but only Mathcad can read it back as executables. Nor can Mathcad read MathML saved from other products such as Maple or Mathematica. MathML has a way to go before it's a truly cross-product standard.

pic

  • Both fixed (top left) and relative (top right) HTML output may be complex to hand-edit.

 

Alongside web publishing, Mathcad's web support includes browser function as an extension of its help system. The standard Windows help covers general Mathcad use, advanced developers and electronic book authors, while the hypertext Resource Center links locally to a tutorial and reusable 'QuickSheets', and to www.mathcad.com for access to support FAQs, a free web library of electronic books and user code, the collaboratory discussion board, and promotion for add-on products. (These include extension packs for communication system design, signal processing, image processing, wavelets, and solving and optimisation; and e-books on queuing theory, the Finite Element Method, and electrical, mechanical and civil engineering.) The case studies emphasise corporate science and a somewhat macho selection of university projects: F1 racing car design, sport aerodynamics, and designing a baseball cover.

In the past, MathSoft aimed rather unspecifically at applied maths users. Wolfram and even Maplesoft (makers of the traditionally 'pure' Maple) have also begun to take an interest in physical units and technical applications. However, Mathcad's new by-line 'the essential tool for every engineer' sums up the market now targeted by MathSoft Engineering & Education. With its ability to produce legible, well-documented and tamper-proof worksheets, and the further benefits of wellintegrated CAD and simulation software, I think it will serve that market well.