Triangular numbers: Difference between revisions

m (→‎{{header|jq}}: explain `def figurates:`)
Line 638:
'''Also works with gojq and fq, the Go implementations of jq'''
 
InThe main point of interest in the following, `$ris |probably `figurates/0`, which generates
an indefinitely long stream of the $r-simplex numbers if $r >= 2, where $r is the input to the filter.
For the sake of illustration, however, `tetrahedrals` and `pentatopics` are defined without reference to `figurates/0`.
 
'''Preliminaries'''
Line 694 ⟶ 695:
 
def tetrahedralRoot:
def cubrt: pow(.; 1/3);
def term(sign):
(3 * .) as $y
| ($y + sign * ( (($y*$y) - (1/27))|sqrt)) | cubrtcbrt;
term(1) + term(-1) -1;
 
2,442

edits