The 
Mathematica Journal
Volume 10, Issue 1

Search

In This Issue
Articles
Trott's Corner
New Products
New Publications
Calendar
News Bulletins
New Resources
Classifieds

Download This Issue 

About the Journal
Editorial Policy
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

Elements--An Object-Oriented Approach to Industrial Software Development
Gerd Baumann
Michal Mnuk

Introduction

Models in engineering as well as in physics, chemistry, finance, mathematics, and economics are characterized by the following two main features.

  • First, any model is based on methods representing an algorithm with which the problem is solved. These methods usually depend on each other or are at best completely independent.
  • The second feature of any model is the occurrence of parameters determining physical, engineering, economic, or other properties and thus the behavior of the system.

The parameters are of central importance when variations of the model are examined. For example these quantities determine bifurcations to different states of the system. By variations we mean not only numeric changes but also symbolic ones.

However, modeling is a sophisticated endeavor of traversing between reality, imagination, and feasibility. It eventually converges to a mathematical description which captures the most essential aspects important for a particular purpose and, at the same time, is simple enough to be treated by formal methods.

We start with an observation that every modeling process involves working with objects and its primary goal is to select features relevant to a specific problem together with relations between them. Different problems in one specific area usually involve a rather limited number of objects. The problem itself is then reflected in the relations between them.

From this point of view it is natural to build a knowledge base containing descriptions of basic objects which often appear in modeling. Such a database would significantly speed up the modeling and provide a basis for rapid prototyping. It is not only a tedious and error-prone task to type in things over and over again, but, in many cases, parametrized solutions for recurring problems could be computed and stored in advance.

Our primary motivation is to facilitate the modeling process in engineering by providing a transparent and easy-to-use knowledge base of objects. In this article we stipulate and analyze requirements on such a system and present a Mathematica package to store and retrieve information about objects.

The proposed system is designed to be, in its nature, primarily static. It is not supposed to include "automatic solvers", although internal and external algorithms will be utilized to perform computation whenever this appears appropriate. Extensions of the knowledge base will always be checked by a human. The reason is that the vast majority of practical problems do not provide easy answers. Even though today's computer systems are very powerful, solutions obtained automatically still need to be post-processed by experts. This makes it impossible to simply add them to an existing knowledge base since sooner or later its consistency would inevitably be destroyed, making it useless.

Objects in Modeling

When we analyze requirements on the design of a system for object representation, we naturally come across some principles already used for years in software engineering: object-oriented programming. It is not surprising that the same or very similar principles will govern the design here.

Object-oriented programming introduced the concepts of classes and inheritance. It can be observed that solutions are often simpler when a hierarchical structure is imposed on the problems.

Another aspect of object-oriented programming may be even more important. Classes and their objects are encapsulated, stand-alone, and well-specified entities that behave the same way in any program--this is a key property of reusable components. This makes it possible to publish code which can be used in various settings without change.

It is clear that these paradigms apply to modeling as well. A hierarchical structure is already in the nature of all mathematical and physical objects while the closeness of used entities is a prerequisite for the use of objects in different environments. These two concepts will play a primary role in the design of a modeling environment.

Object-Oriented Methods in Computer Algebra

The fact that principles of object-oriented programming are compatible with structures in scientific computing led to adopting those methods into computer algebra systems. A proper combination of these two fields yields the key to a solution of our problem. On the one hand, object-oriented design provides for encapsulation and reuse of objects. On the other hand, computer algebra offers a variety of algorithms to work with them.

However, up to now there is no single system that contains these features in a well-balanced symbiosis. We encounter either systems offering implementation of the class concept (C++, Java, SML, Aldor, and so forth), or single- or multi-purpose computer algebra systems providing more or less large sets of algorithms (Maple, Mathematica, GAP, and so forth).

In spite of this fact, a lot of successful work has already been done using object-oriented methods in computer algebra systems. There is an extensive literature on object-oriented numerical methods [1, 2, 3, 4]. Numerical algorithms benefit from the fact that most of the data types they work on are largely supported by classical programming languages so there are quite a few choices. However, numerics do not belong to areas that would primarily benefit from object-oriented paradigms.

Another approach integrates object-oriented programming languages and computer algebra in one application [5, 6, 7, 8]. However, these solutions are mostly aimed at a few specialized fields.

The last option is to stay solely within a computer algebra system. For a long time, Maple lacked a proper concept for data encapsulation. It was finally included in Version 7. An example of object-oriented programming using numerical computation in Maple can be found in [9]. In spite of this, Maple's imperative nature is not well suited for the complex manipulations on data and code necessary when implementing object-oriented features.

Probably the first implementation of classes in Mathematica was done by R. Maeder in [10]. Even though this code was just a proof of concept, it demonstrated the strength of the language and proved that Mathematica provides powerful means for building structures and for data encapsulation.

Applications in engineering require an extensive collection of algorithms which are currently provided only by general computer algebra systems like Mathematica or Maple. In this article we present the package Elements, which provides an implementation of object-oriented features to facilitate modeling directly within Mathematica [11, 12]. The package, which is available from the authors' company [13], goes beyond Maeder's work and has proved to be well suited for the purpose of building a knowledge base of objects from which models are built. In the next section, we postulate and analyze requirements for a working environment that allows rapid development of models in engineering.



     
About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.