March 5, 2021
Hot Topics:

Numeric Computations in Java

  • By Sione Palu
  • Send Email »
  • More Articles »

Allowing operator overloading and complex primitives in Java would make arithmetic coding easy to read, code, and maintain. To illustrate this point, take the following example from Electrical Engineering for a two-element impedance (Z1,Z2) connected as a parallel network to a voltage source (V). This is how to implement the calculation of the electrical current (I) flowing through Z1 and Z2 by using the multiarray package from JSR-83:

  Complex Z1 = new Complex(blah, blah) ; //blah is a double floating-point
  Complex Z2 = new Complex(blah, blah);
  Complex ONE = new Complex(1,0);        //real number one.
  Complex V = new Complex(blah, blah); 

  Complex I = V.times(ONE.div(Z1).plus(ONE.div(Z2));

The above calculation only involves one voltage source (V) and a two-element impedance (Z1 and Z2), but the real world of electronics and circuitry systems involves hundreds, thousands, or even millions of electrical components on a macro board or a microchip. You can imagine how difficult it is coding very long equations for multiple components circuits. It would be much more mathmatically readable if operator overloading or complex primitives were available in Java . The last line of coding from the above example would have looked like the following line if operator overloading were allowed:

  Complex  I = V*(1/Z1+1/Z2) ; //This way of coding is readable and easy.

The development of SPICE (Simulation Program with Integrated Circuit Emphasis) software in Java is starting to emerge from academic institutions. It is still at too early a stage to expect a massive re-write of different current types of SPICEs in Java. As Java's numeric computation capability improves over time, Java will appeal to SPICE commercial software makers.

Multidimensional array

Java lacks true multidimensional arrays. It offers multidimensional arrays only as arrays of one-dimensional arrays and this is implemented in this JSR-83 multiarray package. The lack of true multidimensional arrays causes a problem for optimisation. Getting access to an element of a multidimensional array requires multiple pointer indirection and multiple bound checks at run-time. The proposal from JGF (Grande Forum) is that, if Java performance is to be brought to the same par as Fortran, the language specification requires true rectangular multidimensional arrays in which all rows have exactly the same length. Another proposal is to allow elegant and efficient access with a notation like a[i ,j] instead of calling the set(i ,j) and get(i ,j) accessor methods, which affects performance when dealing with huge matrix arrays.

Applications of Numerical Computing

The following sections give some examples of the application of numerical computing and how different industries adopt them.

Electrical and Electronic engineering

As mentioned in the above example about SPICE, software engineers develop such applications to be used by Electrical and Electronic engineers to build circuitry, microchips, and transistors. A transistor is made up of around a million components. All SPICE-variant software relies mainly on linear algebra techniques and a system of linear equations.

Oil Exploration and Petroleum Industries

Ships of some petroleum companies regularly search for offshore deposits, and their computer systems solve thousands of separate systems of linear equations every day. Seismic data for the equations are obtained from underwater shock waves created by explosions from air guns. The waves bounce off subsurface rocks and are measured by geophones attached to mile-long cables behind the ship. Petroleum companies use supercomputers to solve the systems of linear equations that give them some hard data indicating where to drill.

Linear Programming and Operations Research

The term "Linear Programming" should not be mistaken for computer software programming, because it has nothing to do with computers. It is a branch of mathematics that deals with the optimisations in allocating limited resources. There are many important management decisions today; these are made on the basis of Linear Programming models that utilize hundreds and thousands of variables. The airline industry, for instance, employs Linear Programming software that schedules flight crews, monitors locations of aircraft, and plans the varied schedules of support services such as maintenance and terminal operations. The model of Linear Programming solves equations that involve matrix algebra with huge-size matrices.

Climate and Weather Forecast

In many applications, there is a need for a continuous time stream of weather data to be used as an input to a computer model of processes of interest. High-speed statistical and stochastic models, differential calculus, and matrix algebra software are used to predict and forecast weather patterns.

Financial Modelling

For stock market analysts, stock brokers, merchant bankers, security analysts, commercial bankers, corporate financiers, and so on, it is vital to use numerical analysis software to assist in forming the right decision. Analytic financial modelling software has functionalities that employ common numerical algorithms which are heavily used for financial analysis, such as monte-carlo, probability distributions, matrix algebra, differential calculus, numerical integration, spline approximation, and the like.

There is confusion between the meaning of Financial software and Financial Modelling. This confusion arises from accountants and software developers who have never previously experienced numerical computing. The two fields mean one thing to some developers but for a numerical analyst software developer it is two, similar, overlapping fields. Financial software deals with accounting-type calculations, such as balance sheets, interest rates, and so forth, which do not use any significant amout of memory at all. Financial Modelling involves heavy numeric calculations such as stock-price time-series, portfolio covariance risk, market pricing options such as arbitrage pricing, capital asset pricing model, binomial and black-schole's pricing, and so on. These calculations usually involve massive data-input from financial databases as stock market repository to do calculations using the numerical algorithms mentioned above.

Page 4 of 5

This article was originally published on June 11, 2002

Enterprise Development Update

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

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