Please check also the OpenModelica Modeling and Simulation Environment.
ObjectMath is a programming and modeling environment
for object oriented mathematical modeling and generating efficient C++
or Fortran90 code for use in simulation applications, mostly (numerical,
This system partly automates the conventional approach
of hand translation from mathematical models to numerical simulation code
e.g. in Fortran. The ObjectMath language is an object oriented extension
to the Mathematica computer algebra language, which provides mathematical
notation and symbolic transformations. Thus, the ObjectMath programming
environment offers the following:
ObjectMath is designed and supported by a team
at PELAB (Programming Environment Lab), Linköping University, Sweden.
Some of the new developments of ObjectMath are part of the Modelica
modeling language design effort.
is a collection of papers on various aspects
- the Process of Mathematical Modeling and Software Development
How we go from a initial model to the development of simulation applications
The user has physical application oriented knowledge
Express this as a mathematical, object-oriented specification
This specification is expressed in ObjectMath
Possibly perform symbolic transformations of formulas and
Execute it and obtain results (which may cause adjustments
of the specification)
Graphically present the results (which gives understanding
of the problem that often causes changes to the specifification)
How is software development of a simulation application supported?
of software development with ObjectMath.
We specify the simulation problem through mathematical modeling.
Possibly execute interpretively within Mathematica (for small
Perform model transformations (using the Mathematica computer
Automatically generate code (C++, Fortran90, parallel code
Specify input data for numerical experiments
Run the experiment
Visualize the data
- An Object-oriented Computer Algebra Language
ObjectMath is an Object-Oriented extension to Mathematica,
a computer algebra language from Wolfram
Research . Mathematica functions and equations can be grouped into
classes, in order to structure the mathematical model. Equations and functions
can be inherited from general classes into more specific classes, which
allows reuse within the mathematical model. Below are two example models.
You can see classes and instances in these examples, as well
as inheritance relations between them (including single and multiple
inheritance). The part-of relation allows structured objects to
be expressed as a composition of parts. The ObjectMath class browser can
show both inheritance relations and part-of relations.
Inheritance allows formulae and equations to be reused. (For
large models the amount of ObjectMath code is reduced approximately three
times through reuse as compared to expressing the model in standard Mathematica).
This object oriented way of modeling is a natural way to describe physical
papers [4 , 5 , 8]
- a programming environment
The programming environment include the following components:
See how the internal
components of the environment are connected.
The ObjectMath language - including object-oriented features and type declarations.
The language is integrated with Mathematica.
The code is edited by
Code generator to produce Optimized C++ and Fortran90 code
Form based data entry tool to specify numerical experiments
Visualization tool to draw curves and perform 3D graphics animations based
on simulation results
screendump of the environment
screendump of the environment
papers [4 , 5 , 8]
- generating efficient code
The equations, formulae and functions are symbolically transformed at compile
or design time. Part of the computation is eliminated through symbolic
transformations, which yield partially reduced symbolic expressions.The
rest is computed numerically at run-time. Remaining ordinary differential
equations are solved numerically at run-time.
Code for numerical computation is generated
common subexpression elimination
unfolding for some functions
The code is linked together with library routines, e.g. for i/O
and numeric ODE solution.
A two-body example:
Pure Mathematica code - 6 minutes
Generated C++ code - 10 sec
Generated C++ code with common subexpression elimination - 1 sec
Applications to realistic models:
A mathematical model of surface interaction have been designed in cooperation
50% of implementation is generated from ObjectMath.
147 KB ObjectMath 581
KB Mathematica 546
KB C++ code
Parallel code generator
This part of the system is more experimental, and has not been used in
industrial applications. There are two approaches to Extracting Parallelism
from Mathematical Models (so far in ObjectMath primarily for ODEs):
Parallelism at the equation system level
also papers [1,2,10,11,12,13]
Analyze dependencies between equations
Find partly independent Strongly Connected Components (SCCs)
The SCCs form subsystems of equations that can be solved partly in parallel
or in pipeline
see the scheme
of partitioning and example
Parallelism at the equation level
visualisation using ObjectMath
We generate efficient C++/Fortran90 code from ObjectMath models which include
geometry descriptions expressed as parametric surfaces. This code is linked
together with a powerful 3D browsing environment which uses OpenGL with
possible hardware support, e.g. Creator 24bit 3D graphics on UltraSparc
See screendump of the BEAST
environment (GIF,color,85K) (PS,
color 100K) (PS, B/W 100K)
also papers 
The ObjectMath team
ObjectMath has been designed at the PELAB
laboratory at Dept. of Computer and Information
Science , Linköping University, Linköping,
Sweden . The team has the following members:
Peter Fritzson, firstname.lastname@example.org(Project
leader and the main contact person. Design of ObjectMath 5/Modelica. Programming
Vadim Engelson (Programming environment and visualization/3Danimation.
Johan Gunnarsson (Dept.
of Electrical Engineering, ISY) (Design of ObjectMath 5)
Patrik Nordling (Bearing simulation applications
using parallel computing)
Tommy Persson (Applications in scientific computing.
Patrik Hägglund ( Model design, comparative analysis
of computer algebra languages)
Questions about availability of the implementation should be directed
to Peter Fritzson.
Niclas Andersson (Parallel code generation, parallel
Rickard Westman (ObjectMath language and environment,
Lars Viklund (Programming environment, networking,
parallel computing platforms)
Lars Willför (Sequential code generation)
Visit collection of ObjectMath papers and
This page has been designed by Vadim Engelson
Last change 10 April 1997