Using defined operators and function arrays to solve non-linear equations in APL2

  • Authors:
  • Stephen M. Mansour

  • Affiliations:
  • -

  • Venue:
  • APL '93 Proceedings of the international conference on APL
  • Year:
  • 1993

Quantified Score

Hi-index 0.00

Visualization

Abstract

There are many mathematical algorithms such as Newton's method used to calculate solutions to non-linear equations. This paper will show how easy it is to implement these algorithms in APL2 with a minimum of code using the defined operator and careful design of its input functions. Although a very powerful and unique approach to solving non-linear equations using APL was described recently [Ne89], the emphasis in this paper is on the method of developing an application using APL2 and the concepts of defined operators and function arrays. This requires that input functions be robustly designed to take arrays as arguments and to produce array results much like primitive scalar functions. In this manner one can minimize the number of calls to the input function and take advantage of APL2's array handling capabilities. Since operators are permitted at most two operands, it is critical to minimize the number of input functions. This requires the input function designer to think in terms of function arrays. While there has been some discussion of the theory [Be84] and implementation [Be91] of function arrays, they can be created in APL2 with defined operators [Bk85]. In fact, function arrays can easily be defined in standard APL.