<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://ja.xen.wiki/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AHarmonic_entropy</id>
	<title>モジュール:Harmonic entropy - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://ja.xen.wiki/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3AHarmonic_entropy"/>
	<link rel="alternate" type="text/html" href="https://ja.xen.wiki/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Harmonic_entropy&amp;action=history"/>
	<updated>2026-06-05T23:38:57Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ja.xen.wiki/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Harmonic_entropy&amp;diff=1283&amp;oldid=prev</id>
		<title>Dummy index: ページの作成:「local limits = require(&quot;Module:Limits&quot;) local rat = require(&quot;Module:Rational&quot;) local p = {}  -- Compute Harmonic Shannon entropy for an interval of `c` cents -- `c`, `deviation`: in cents -- `ratios`: an array of rational numbers -- `norm`: a function of rational numbers function p.harmonic_entropy(c, ratios, deviation, norm) 	norm = norm or function(ratio) 		return math.sqrt(rat.benedetti_height(ratio)) 	end 	deviation = deviation or 1200 * math.log(1.01, 2) 	ratio…」</title>
		<link rel="alternate" type="text/html" href="https://ja.xen.wiki/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Harmonic_entropy&amp;diff=1283&amp;oldid=prev"/>
		<updated>2025-11-16T03:55:02Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「local limits = require(&amp;quot;Module:Limits&amp;quot;) local rat = require(&amp;quot;Module:Rational&amp;quot;) local p = {}  -- Compute Harmonic Shannon entropy for an interval of `c` cents -- `c`, `deviation`: in cents -- `ratios`: an array of rational numbers -- `norm`: a function of rational numbers function p.harmonic_entropy(c, ratios, deviation, norm) 	norm = norm or function(ratio) 		return math.sqrt(rat.benedetti_height(ratio)) 	end 	deviation = deviation or 1200 * math.log(1.01, 2) 	ratio…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local limits = require(&amp;quot;Module:Limits&amp;quot;)&lt;br /&gt;
local rat = require(&amp;quot;Module:Rational&amp;quot;)&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Compute Harmonic Shannon entropy for an interval of `c` cents&lt;br /&gt;
-- `c`, `deviation`: in cents&lt;br /&gt;
-- `ratios`: an array of rational numbers&lt;br /&gt;
-- `norm`: a function of rational numbers&lt;br /&gt;
function p.harmonic_entropy(c, ratios, deviation, norm)&lt;br /&gt;
	norm = norm or function(ratio)&lt;br /&gt;
		return math.sqrt(rat.benedetti_height(ratio))&lt;br /&gt;
	end&lt;br /&gt;
	deviation = deviation or 1200 * math.log(1.01, 2)&lt;br /&gt;
	ratios = ratios&lt;br /&gt;
		or limits.integer_limit(200, function(ratio)&lt;br /&gt;
			if math.abs(rat.cents(ratio) - c) &amp;gt; 3 * deviation then&lt;br /&gt;
				return 1 / 0&lt;br /&gt;
			end&lt;br /&gt;
			return norm(ratio)&lt;br /&gt;
		end, 100)&lt;br /&gt;
&lt;br /&gt;
	local function gaussian(x)&lt;br /&gt;
		return math.exp(-x * x / (2 * deviation * deviation)) / (deviation * math.sqrt(2 * math.pi))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function weighted_gaussian(ratio)&lt;br /&gt;
		return gaussian(rat.cents(ratio) - c) / norm(ratio)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local q_norm = 0&lt;br /&gt;
	for _, ratio in pairs(ratios) do&lt;br /&gt;
		q_norm = q_norm + weighted_gaussian(ratio)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function probability(ratio)&lt;br /&gt;
		return weighted_gaussian(ratio) / q_norm&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local entropy = 0&lt;br /&gt;
	for _, ratio in pairs(ratios) do&lt;br /&gt;
		local p_i = probability(ratio)&lt;br /&gt;
		if p_i &amp;gt; 1e-5 then&lt;br /&gt;
			entropy = entropy - p_i * math.log(p_i)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return entropy&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Dummy index</name></author>
	</entry>
</feed>