Math is Easy…

Remember the first time you held a calculator as a child and the thrill it gave you when you found that it adds large numbers in less than a micro second, followed by instant anger toward your math teacher for making you do all that math the hard way when this magnificent tool existed? Well, if you use spreadsheets or programming languages to do your math, you will probably ask, “Why didn’t anyone tell me about HyperMath?”

Math-Is-Easy

So what is HyperMath?

HyperMath is a numerical computing environment consisting of a high-level programming language, extensive math libraries and a comprehensive set of interactive development tools. Of course, in true Altair spirit, HyperMath is also tightly integrated with HyperWorks, which allows for seamless pre- and post-processing of computer-aided engineering data.

Was there really a need for this?

As engineers, we love math, but we also realize that math is a tool for us to do real engineering jobs – build things, fix things and improve things. So we need a tool that will enable us to rapidly develop complex math models and consider quick what-if’s to perform real engineering jobs. These needs could include such scenarios as identifying the parameters for a non-linear curve, creating a custom filter to reduce noises, reading data from test equipments and performing additional computations to identify the behavior of a system. To address these requirements and many more, Altair decided to focus on creating a simple programming environment for engineers that comes pre-loaded with a diverse set of mathematical libraries. The result: HyperMath.

What can I do with HyperMath?

If you are a structural engineer but you secretly yearn to be a software developer, HyperMath provides you with an easy-to-use and intuitive high-level scripting language designed for numerical code development and interactive code debugging, enabling visual identification of programming errors and fast troubleshooting without the need to embed diagnostic code.

On the other hand, if you are a CAE engineer who wants to automate redundant tasks, you can access a comprehensive suite of mathematical libraries and the built-in CAE and test-data readers for most of the popular FEA data formats for pre- and post-processing. If you decide to be more adventurous, you can use the direct integration with the HyperWorks suite to easily integrate HyperMath solutions into any CAE process.

So why exactly is math easy with HyperMath?

HyperMath uses a matrix-based data structure, and therefore the representations and manipulations of data are very easy.  Basic matrix operations like addition and inversion are done easily via operators, allowing the code to closely resemble the equivalent mathematical expression. It supports complex numerical data and arithmetic operations on complex data, using a compact notation to index a range of elements in vectors and matrices and eliminating the need to implement loops to carry out the same operations, while providing faster code execution.

HyperMath comes out of the box with a rich math and utility function library that addresses a wide range of needs, such as initializing, querying and performing relational operations on matrix contents and executing operations on strings. This capability helps eliminate the burden of implementing the same in code. Some of the built-in library elements include matrix math and algebra, signal processing, statistical analysis, differential equations, linear and nonlinear systems solver, plotting functions, optimization libraries and others. So you can simply tap into the standard libraries, pass the necessary inputs and receive the output from the libraries to continue with math modeling.

For example: To multiply two matrices (A & B):

A = [1,2;3,4]
B = [1,2;3,4]
C = A*B
print(C)

The output would be:

[Matrix] 2 x 2
7          10
15          22

To invert a matrix:

A = [1,2;3,4]
print(Inv(A))

The output would be:

[Matrix] 2 x 2
-2           1
1.5        -0.5

Unlike traditional programming languages, like C or Fortran, HyperMath contains a data visualization module that enables users to quickly generate line, bar and scatter plots. The plot attributes can be easily modified interactively through the user interface or directly inside the script. This feature allows you to visualize and validate the math model.

Expanding the boundaries, what ELSE can I do with HyperMath?

HyperMath has been used in plenty of areas. We look at four such applications here: 1) HyperMath-HyperStudy integration, 2) HyperMath as a reader for HyperGraph, 3) curve fitting for nonlinear curves and 4) transfer function written in HyperMath.

The first application is HyperStudy integration with HyperMath. An academic customer wanted to find the minimum weight interference fit assembly that satisfies nonlinear design requirements. Therefore, he used HyperMath to create the surrogate model, while HyperStudy was used for multi-objective optimization. Because of their integration, the complementary HyperWorks products sped up development. The flowchart below demonstrates the process flow.

Integrated process flow

The second application is one of the most common scenarios in the CAE field: engineers receive test data in an ASCII file that cannot be read by standard plotting tools, such as HyperGraph. The user can write a HyperMath script to read the file, register that script in HyperGraph and call the function inside HyperGraph to plot the data. In the picture below, the file on the left side has six headers and cannot be read into HyperGraph directly. The user can write a simple script in HyperMath, as shown in the middle picture below, to ignore the first six headers and then register that script in HyperGraph. The file can be plotted in HyperGraph as shown in the picture on the right side.

Product Flow

In the third application, HyperMath can be used to estimate parameters for a highly nonlinear curve. A function called “NLCurveFit” is employed to perform an optimization algorithm using the initial guessed values for the parameters. The user has the ability to state the maximum number of iterations and also the tolerance of acceptance in this function. The plot below shows the initial curve and the curve created using the estimated material parameters. The equation fitted for the curve below is:

Fitted Equation

Where C1, C2 & C3 are the parameters estimated using HyperMath

Curve Fitting Plot

The final application was for a major automotive manufacturer. The customer was looking for an all-in-one solution allowing creation of a transfer function to measure engine efficiency. HyperMath turned out to be a perfect solution, because it could read the CAE data directly without the need to write CAE readers. The built-in math libraries helped reduce the run time significantly, while the plotting capabilities helped to plot and validate the results all in a single package. In addition, the fact that the engineer was already a HyperWorks customer meant HyperMath was readily available for him, thereby avoiding the hassle of meeting with his purchasing department to request more software.

Altair’s HyperMath is geared toward math modeling but is versatile enough to be used in diverse applications. The built-in libraries that come standard with HyperMath enable the user to build math models quickly and, as a result, concentrate more time on real engineering jobs – building things, fixing things and improving things. After all, math is easy—with HyperMath.

► Learn more about HyperMath

► Watch the HyperMath 11.0 On-Demand Webinar

Nandeesh Madapadi

Franck Delcroix

Program Manager at Altair France
Franck Delcroix

Latest posts by Franck Delcroix (see all)