Jump to navigation Jump to search


653 bytes added, 08:04, 27 September 2020
This also avoids reusing variable names, and thus ensures that the code can be rerun from any point. The chosen additional variable names are still short, but quite indicative of what they signify ([[wikipedia:variance|variance]]). Finally, the <source lang=apl inline>.5</source> is expanded to <source lang=apl inline>0.5</source> which helps to clarify that this is a decimal number and not an [[inner product]].
A more modern approach breaks out the symmetry into a utility function [[train]], and uses [[leading axis theory]] combined with [[operator]]s and reordering of terms to avoid parentheses (which would otherwise require a mental stack to understand). Finally, the correlation coefficient is defined as a stand-alone function, using [[inner product]] to combine [[sum]]mation with [[multiply|multiplication]]
<source lang=apl>Var←+/2*⍨⊢-+⌿÷≢
r←x R y</source>
Note that <source lang=apl inline>+⌿÷≢</source> is an [[idiom]] (common phrase) and is read as ''average'' by even moderately experienced APL programmers.
=== IBM ===

Navigation menu