Averages/Simple moving average: Difference between revisions

no edit summary
No edit summary
Line 566:
Next number = 2, SMA_3 = 3.0, SMA_5 = 3.8
Next number = 1, SMA_3 = 2.0, SMA_5 = 3.0</pre>
 
=={{header|TI-83 BASIC}}==
Prompts for a source list <tt>A</tt>, the length <tt>K</tt> of the moving average and a target list <tt>B</tt> for the result. The 'L' in "LA" and "LB" is found in "List"/"OPS".
:Prompt LA,K,LB
:
:For(I,1,dim(LA))
:0→S
:For(J,I-K+1,I)
:If J≥1
:S+LA(J)→S
:End
:S/K→LB(I)
:End
Anonymous user