This paper shows two generalisations of the APL2 domino function. Domino has two roles, first the solution of non-degenerate systems of linear equations, and secondly the estimation of linear least squares fits. There is an inherent duality between these, since the first consists of finding a series of x-values to fit a set of fixed c's (coefficients), whereas the second consists of finding a series of c's to fit a set of fixed x- and y-values. This duality is exploited in extending both roles of domino using Newton-Raphson iteration to find roots of non-linear systems on the one hand, and to perform non-linear curve fitting on the other. The nature of the problem is such that it is natural to write APL2 solutions using operators rather than functions, and in each case a corresponding J solution is given. Further simple idioms involving domino give the consequent fitted values and Analysis of Variance calculations. The paper concludes with a compact tool-kit showing in parallel columns both the APL2 and J codes needed to achieve these extensions. The brevity of the J code speaks for itself.
/lp/association-for-computing-machinery/applying-matrix-divide-in-apl-and-j-0fLOb0s3kM