Talk:Simple examples: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Created page with "Neither 2 mave 3 4.5 7 21 nor 2(+⌿÷≢)/3 4.5 7 21 work in Dyalog APL 18 or GNU APL. --~~~~")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Moving average ==
Neither  
Neither  


Line 8: Line 10:


work in Dyalog APL 18 or GNU APL. --[[User:Andrii Makukha|Andrii Makukha]] ([[User talk:Andrii Makukha|talk]]) 15:19, 26 June 2020 (UTC)
work in Dyalog APL 18 or GNU APL. --[[User:Andrii Makukha|Andrii Makukha]] ([[User talk:Andrii Makukha|talk]]) 15:19, 26 June 2020 (UTC)
You're totally right. It is plain wrong because it tries to use windowed reduction in APL like infix in J. An easy fix would be to combine <syntaxhighlight lang=apl inline>(+⌿÷≢)</syntaxhighlight> with concatenation <syntaxhighlight lang=apl inline>,</syntaxhighlight> by atop so that it looks like <syntaxhighlight lang=apl inline>2((+⌿÷≢),)/3 4.5 7 21</syntaxhighlight> (or <syntaxhighlight lang=apl inline>2(+⌿÷≢)⍤,/3 4.5 7 21</syntaxhighlight> in Dyalog 18.0); a general solution (allowing window size higher than 2) would be to extract windows and apply average on each of them <syntaxhighlight lang=apl inline>(+⌿÷≢)¨ 2,/3 4.5 7 21</syntaxhighlight>. I doubt if it's worth keeping either way in this context. --[[User:Bubbler|Bubbler]] ([[User talk:Bubbler|talk]]) 14:07, 27 June 2020 (UTC)
:I've removed the moving average part [[User:Adám Brudzewsky|Adám Brudzewsky]] ([[User talk:Adám Brudzewsky|talk]]) 22:45, 27 June 2020 (UTC)

Latest revision as of 10:45, 11 September 2022

Moving average

Neither

   2 mave 3 4.5 7 21

nor

   2(+⌿÷≢)/3 4.5 7 21

work in Dyalog APL 18 or GNU APL. --Andrii Makukha (talk) 15:19, 26 June 2020 (UTC)

You're totally right. It is plain wrong because it tries to use windowed reduction in APL like infix in J. An easy fix would be to combine (+⌿÷≢) with concatenation , by atop so that it looks like 2((+⌿÷≢),)/3 4.5 7 21 (or 2(+⌿÷≢)⍤,/3 4.5 7 21 in Dyalog 18.0); a general solution (allowing window size higher than 2) would be to extract windows and apply average on each of them (+⌿÷≢)¨ 2,/3 4.5 7 21. I doubt if it's worth keeping either way in this context. --Bubbler (talk) 14:07, 27 June 2020 (UTC)

I've removed the moving average part Adám Brudzewsky (talk) 22:45, 27 June 2020 (UTC)