Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -6,7 +6,7 @@ func entropy s$ .
for cnt in d[]
if cnt > 0
prop = cnt / len s$
entr -= (prop * logn prop / logn 2)
entr -= (prop * log10 prop / log10 2)
.
.
return entr

View file

@ -0,0 +1,16 @@
program shannon_entropy;
print(entropy "1223334444");
op entropy(symbols);
hist := {};
loop for symbol in symbols do
hist(symbol) +:= 1;
end loop;
h := 0.0;
loop for count = hist(symbol) do
f := count / #symbols;
h -:= f * log f / log 2;
end loop;
return h;
end op;
end program;