Variance

Description

Counting observation variance from list elements

Source: PROLOG str. 198 Wydawnictwo PLJ Warszawa 1991 ISBN 83-85190-63-5

Download

Program source code: variance.pl

Listing

wari(L, W) :- sred(L, Sr), rozn2(L, H, Sr), suma(H, Suma, 0, Ilosc, 0),
W is Suma/Ilosc.
rozn2([], [], _).
rozn2([H|T], [R|T1], Sr) :- R is (H - Sr)*(H - Sr), rozn2(T, T1, Sr).
 
test :- wari([1, 2, 3, 4, 5]).

Comments

pl/prolog/pllib/variance.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0