Anonymous user
Averages/Simple moving average: Difference between revisions
→E: update to actual output, with scrollbar
(→{{header|TI-83 BASIC}}: translated for TI-89, marked incorrect for not being stateful) |
(→E: update to actual output, with scrollbar) |
||
Line 176:
}</lang>
<div style="overflow: auto; max-height: 12em;"><lang e>? for period in [3, 5] {
> def [insert, average] := makeMovingAverage(period)
> println(`Period $period:`)
Line 185:
> println()
> }
Period 3:
1 1.0
2 1.5
3 2.0
5 4.0
5 4.666666666666667
2.0</lang>▼
4 4.666666666666667
3 4.0
2 3.0
1 2.0
Period 5:
1 1.0
2 1.5
3 2.0
4 2.5
5 3.0
5 3.8
4 4.2
3 4.2
2 3.8
1 3.0
=={{header|Forth}}==
|