October 20, 2018
Hot Topics:

# Numeric Computations in Java

#### Input data error

Errors of this type arise from input measurements and it is vital that there is a mechanism to control it. This is a very important issue in the design of DSP (Digital Signal Processor) chipsets and feed-back control systems, where noise (unwanted data) is being fed into the system, which offsets the desired set-point of the whole system. DSP is used in almost all electronic devices on the market, including computers, TVs, video and mobile phones, and so on.

#### Propagation error

Propagation errors occur from a repetitive accumulation of earlier, smaller errors in an internal iteration of of a numeric computation. As each new iteration executes the error from previous steps, it carries on to the next and tends to magnify. From the bisection algorithm pseudo-code mentioned above, there is a decrease of precision every time the iteration starts from the DO loop, which stores the result from the previous step; this number will be the input for the next round of iteration. Again, this error type is taken into account by software engineers who are designing DSP and control systems.

#### Machine accuracy (EPSILON)

The accuracy of machine measurement is the smallest floating-point number that, when added to floating-point number 1.0, produces a result different from 1.0. This smallest floating number is called epsilon. All numeric-intensive applications where a likelihood of a divide-by-zero is encountered, epsilon is added to the denominator of the intended function to stop the propagation of a "NAN" (NOT-A-NUMBER) or "Inf" (INFINITY) data-type which will lead to floating-point overflow. An example of this is a type of signal known as the sinc pulse in the area of Digital Signal Processing. A sinc pulse is represented mathematically by the following equation as a function of time.

If you try to substitute zero for the independent variable t (t=0) in the sinc pulse equation, the result is an error with a divide-by-zero. In Java, an ArithmeticException is thrown if a divide-by-zero is found. The answer, as we know from applying the theory of limit in calculus to the sinc pulse, should be 1.0, but the computer returns an error. Now, if epsilon (2.0E-16) is added to variable t, both in the numerator and the denominator, you will get the correct answer -- that is, 1.0 -- and there is no ArithmeticException thrown. The addition of epsilon will not alter the magnitude of the target function at all because epsilon is so small (almost zero). It is basically like adding a zero to a number, which changes nothing. This is a normal practice (adding epsilon) in the development of numeric intensive software such as in the areas of particle Physics, DSP, Cosmology, Finance, Stochastic processes in Statistics, Econometric analysis, Engineering, and Oil Exploration.

### Java API for Intensive Numeric Computing

Currently there is a Java Specification Request (JSR-83) to draft an API for numeric computation. JSR-83 proposes a package to implement rectangular multidimensional arrays for the Java platform. This draft is endorsed by the Java Grande Forum (JGF). This forum was formed by representatives from different industries and academic institutions with special interests to act in an advisory role to those working on Grande Applications. They address Java language design and implementation issues and relay this input directly to Sun. A Grande Application is defined as a software application that consumes a lot of computer resources, and any software which is numerically intensive fits this definition.

This API supports multidimensional arrays; a multiarray is characterised by its rank, data-type (double floating-point), and shape. The multiarray package supports all types of primitives and complex numbers. A multiarray package also supports the concept of regular multiarray sections, and this corresponds to a sub-array of another multiarray.

This package also implements Fortran-like functionality for arrays, such as array elementwise multiplication, addition, subtraction, and division. Arrays can be concatenated (merged) column-wise, provided the arrays to be merged have the same number of rows or sub-arrays have the same number of columns. Elementary and transcendal functions are also implemented and an entry element of an array can be accessed by the getters and setters method. The multiarray package is implemented without a change to the JVM (Java Virtual Machine), JNI (Java Native Interface), or the Java language specification. Multidimensional arrays are the foundations of the scientific, engineering, and numeric-intensive types of computation.

The target platforms for this multiarray package are the desktop, server, personal, embedded, card, and so forth; the proposed name for this package is javax.math.multiarray, although it has not yet been finalized. The multiarray package is based on the NinJA (Numeric Intensive Java) project from IBM., which can be freely downloaded. This package also implements BLAS (Basic Linear Algebra Subroutines) routines.

Page 2 of 5

Comment and Contribute

(Maximum characters: 1200). You have characters left.

## Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

## Most Popular Developer Stories

Thanks for your registration, follow us on our social networks to keep up-to-date