If you replace any of those numbers with 0, it will all collapse to 0 - perhaps not what you want. But it's not hard to write such a program:
geometric_mean1 =: (+/ % #) &. (^."1) @: (0&>.) geometric_mean1 2 4 8 4 geometric_mean1 _2 4 8 0
geometric_mean2 =: (+/ % #) &. (^."1) @: (>. -) geometric_mean2 _2 4 8 4 geometric_mean2 2 4 8 4
geometric_mean =: (+/ % #) &. (^."1)
If you replace any of those numbers with 0, it will all collapse to 0 - perhaps not what you want. But it's not hard to write such a program:
If you want to replace negative numbers with their positive counterparts, you may first replace a number with its absolute value: Original geometric_mean probably meant to be - note the copula (assignment symbol) and rank of first verb (^.) .