<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sumit Tripathi on Medium]]></title>
        <description><![CDATA[Stories by Sumit Tripathi on Medium]]></description>
        <link>https://medium.com/@sumit.tripathi?source=rss-ef8be19b30a6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hyCSjqgY9uCicLmWwQ6-3Q@2x.jpeg</url>
            <title>Stories by Sumit Tripathi on Medium</title>
            <link>https://medium.com/@sumit.tripathi?source=rss-ef8be19b30a6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:25:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sumit.tripathi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[正太分布 和 对数正态分布 和幂律的关系 （和其他分布的关系）]]></title>
            <link>https://medium.com/@sumit.tripathi/%E6%AD%A3%E5%A4%AA%E5%88%86%E5%B8%83-%E5%92%8C-%E5%AF%B9%E6%95%B0%E6%AD%A3%E6%80%81%E5%88%86%E5%B8%83-%E5%92%8C%E5%B9%82%E5%BE%8B%E7%9A%84%E5%85%B3%E7%B3%BB-%E5%92%8C%E5%85%B6%E4%BB%96%E5%88%86%E5%B8%83%E7%9A%84%E5%85%B3%E7%B3%BB-9e0cc9396230?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e0cc9396230</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 11:29:10 GMT</pubDate>
            <atom:updated>2026-11-23T11:29:10.167Z</atom:updated>
            <content:encoded><![CDATA[<h4>全部的分布是可变的取决于随机变量的分布</h4><p>今天有机会看 Veritasium 的很多视频 哈哈。有一个视频是根据幂律，另外是根据 Actions (物理的概念）具体根据 A 到 B 有很多条路经 等等。不知道为什么 我觉得我们可以组合两个概念的。我们在数学的分布一般是 正态分布。有一些平均是比较普及的 其他事比较少遇见的 好像 Outliers。可是还有很多种的分布好像 幂律， Binomial，Chi-square，Rayleigh，等等。为何有很多种呢？ 我觉得有可能这是在与我们的每一个随机变量的分布。比如说 如果我们真再看雨的分布。它有很多因素对他有很多影响 有温度，云，季，天气，等等。如果这些的随机变量是有限的 我们组和它们时有可能有一种的分布在于我们的随机变量的 alignment。相反，如果我们看公民的收入分布。这边也有很多随机变量 比如 职业，工业，城市，机会，等等。如果有一些随机变量是无数的，有可能对我们的结果的分布也有影响。因此它可以从正态分布改为幂律的分布。</p><p>我要试试看 若果这是真的假的所以让AI 做了一个Simulation。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1R-aimGpvdPxNBD7Lr2Kxw.png" /><figcaption>上面的向量们是好像很多变量。每一个变量有不同的Magnitude 和Phase。组合以后我们有最后的向量。我们可以再实验random 然后话我们的分布。</figcaption></figure><p>上面做的是好像一种的正态分布。我们也可以改变我们的向量 或者变量 因此可以改变我们的分布。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FBDnhbsYlfrkyBeM0OvTw.png" /><figcaption>当我们的变相是一般往一样的</figcaption></figure><p>这边我们会发现这是好像一种的Rayleign / Chi-square 等等 的分布的。我们可以加这些的向量 也还可以乘以它们！好像 复合的影响。那大家可以问问 什么时候会 +/- 什么时候会 x/<strong>÷。当我们的结果是比例变量 比如说为了每一个变量如果结果不是一样 我们会用 </strong>x/<strong>÷。</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8ptljccAcv4Xxz07x-TvQ.png" /><figcaption>当我们乘以向量 我们可以得到幂律 如果大多数的向量是aligned 的</figcaption></figure><p>如果真的是这样，我觉得对我们的概率 也有影响 因为 我们可以明白好内容的变量的分布的ui我们的概率分布有很多影响。它可以改变我们的分布。</p><p>而且 因为我刚刚学根据瓶颈 Bottleneck，我觉得这对我们的分布也有影响的。因为一般我们的资源或者很多变量是比较有限的 或者慢慢改变的。所以我们可以继续学什么Critical point 会发起好像 Veritasium做的？而且可以安排我们的因素和变量/向量 因此我们可以明白哪里是我们的瓶颈？</p><pre>&lt;!doctype html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, viewport-fit=cover&quot;&gt;&lt;title&gt;One model, many distributions&lt;/title&gt;<br>&lt;style&gt;<br>:root{--bg:#f2f5f8;--pn:#fff;--ink:#16222d;--mu:#5b6b7a;--ln:#d5dde5;--wv:#1f6fb2;--pin:#d1495b;--fit:#b7791f;color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}<br>@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0f1923;--pn:#16232f;--ink:#dbe6ef;--mu:#8fa2b3;--ln:#2a3a49;--wv:#6cb6ff;--pin:#ff7a8a;--fit:#e8b04a;color-scheme:dark}}<br>:root[data-theme=dark]{--bg:#0f1923;--pn:#16232f;--ink:#dbe6ef;--mu:#8fa2b3;--ln:#2a3a49;--wv:#6cb6ff;--pin:#ff7a8a;--fit:#e8b04a;color-scheme:dark}<br>*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.45 system-ui,-apple-system,&quot;Segoe UI&quot;,sans-serif}<br>.w{max-width:900px;margin:auto;padding:18px}h1{margin:0 0 4px;font-size:26px}p{margin:0 0 8px;color:var(--mu)}<br>.pn{background:var(--pn);border:1px solid var(--ln);border-radius:10px;padding:14px;margin-top:14px}<br>.ctl{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}<br>label{display:block;font-size:13px;color:var(--mu);margin-bottom:3px}label b{color:var(--ink)}select,input[type=range]{width:100%}select{padding:6px;font:inherit}<br>button{font:inherit;font-size:13px;padding:6px 10px;border-radius:6px;border:1px solid var(--ln);background:var(--bg);color:var(--ink);cursor:pointer;margin:8px 6px 0 0}<br>canvas{width:100%;height:auto;display:block}h2{font-size:14px;margin:0 0 6px}<br>.g{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media(max-width:640px){.g{grid-template-columns:1fr}}<br>#v{font-size:20px;font-weight:700;color:var(--ink);margin:0 0 4px}#err{color:var(--pin)}<br>&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;div class=&quot;w&quot;&gt;<br>&lt;h1&gt;One model, many distributions&lt;/h1&gt;<br>&lt;p&gt;Every variable is a vector with a size and a phase. The same vectors give a normal, log-normal, power-law or locked result depending only on how they are aligned and how unequal their sizes are.&lt;/p&gt;<br>&lt;div class=&quot;pn&quot;&gt;&lt;div class=&quot;ctl&quot;&gt;<br>&lt;div&gt;&lt;label for=&quot;mode&quot;&gt;Interaction&lt;/label&gt;&lt;select id=&quot;mode&quot;&gt;&lt;option value=&quot;add&quot;&gt;Add (waves interfere)&lt;/option&gt;&lt;option value=&quot;mult&quot;&gt;Multiply (effects compound)&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;<br>&lt;div&gt;&lt;label for=&quot;al&quot;&gt;Alignment of phases: &lt;b id=&quot;vA&quot;&gt;0&lt;/b&gt;&lt;/label&gt;&lt;input type=&quot;range&quot; id=&quot;al&quot; min=&quot;0&quot; max=&quot;1&quot; step=&quot;0.01&quot; value=&quot;0&quot;&gt;&lt;/div&gt;<br>&lt;div&gt;&lt;label for=&quot;sp&quot;&gt;Unequal sizes: &lt;b id=&quot;vS&quot;&gt;0.3&lt;/b&gt;&lt;/label&gt;&lt;input type=&quot;range&quot; id=&quot;sp&quot; min=&quot;0&quot; max=&quot;1&quot; step=&quot;0.01&quot; value=&quot;0.3&quot;&gt;&lt;/div&gt;<br>&lt;/div&gt;<br>&lt;button id=&quot;pl&quot;&gt;Play: sweep alignment&lt;/button&gt;&lt;button id=&quot;cl&quot;&gt;Clear pinned vectors&lt;/button&gt;&lt;/div&gt;<br>&lt;div class=&quot;pn&quot;&gt;&lt;p id=&quot;v&quot;&gt;&lt;/p&gt;&lt;p id=&quot;info&quot;&gt;&lt;/p&gt;&lt;p id=&quot;err&quot;&gt;&lt;/p&gt;&lt;/div&gt;<br>&lt;div class=&quot;pn&quot;&gt;&lt;h2&gt;One trial: 60 vectors laid head to tail. Click to pin your own (red).&lt;/h2&gt;&lt;canvas id=&quot;c1&quot; width=&quot;800&quot; height=&quot;280&quot;&gt;&lt;/canvas&gt;&lt;/div&gt;<br>&lt;div class=&quot;g&quot;&gt;&lt;div class=&quot;pn&quot;&gt;&lt;h2&gt;Result x, over 3000 trials&lt;/h2&gt;&lt;canvas id=&quot;c2&quot; width=&quot;400&quot; height=&quot;220&quot;&gt;&lt;/canvas&gt;&lt;/div&gt;<br>&lt;div class=&quot;pn&quot;&gt;&lt;h2&gt;ln x&lt;/h2&gt;&lt;canvas id=&quot;c3&quot; width=&quot;400&quot; height=&quot;220&quot;&gt;&lt;/canvas&gt;&lt;/div&gt;&lt;/div&gt;<br>&lt;p style=&quot;margin-top:10px&quot;&gt;Orange: normal fit. Bell on the left means normal. Bell on the right means log-normal. A one-sided ramp on the right means power law.&lt;/p&gt;<br>&lt;/div&gt;<br>&lt;script&gt;<br>(function(){<br>var $=function(i){return document.getElementById(i)},R=Math.random,N=60;<br>var S={mode:&#39;add&#39;,al:0,sp:0.3},pinned=[],view={x:0,y:0,s:1},timer=null,dir=1;<br>function css(n){return getComputedStyle(document.documentElement).getPropertyValue(n).trim()||&#39;#888&#39;}<br>function amp(){var alpha=8-6.8*S.sp;return Math.pow(1-R(),-1/alpha)}<br>function trial(rec){<br> var re=0,im=0,i,a,f,c,s;<br> for(i=0;i&lt;pinned.length;i++){re+=pinned[i][0];im+=pinned[i][1];if(rec)rec.push([pinned[i][0],pinned[i][1],1])}<br> for(i=0;i&lt;N;i++){a=amp();f=(1-S.al)*Math.PI*(2*R()-1);c=a*Math.cos(f);s=a*Math.sin(f);re+=c;im+=s;if(rec)rec.push([c,s,0])}<br> if(S.mode==&#39;mult&#39;)return{x:Math.exp(Math.max(-60,Math.min(60,0.5*re/Math.sqrt(N)))),re:re,im:im};<br> return{x:Math.hypot(re,im),re:re,im:im};<br>}<br>function mom(a){var n=a.length,m=0,v=0,t=0,i,d;for(i=0;i&lt;n;i++)m+=a[i];m/=n;for(i=0;i&lt;n;i++){d=a[i]-m;v+=d*d;t+=d*d*d}v/=n;var sd=Math.sqrt(v);return{m:m,sd:sd,sk:sd&gt;0?t/n/(sd*sd*sd):0}}<br>function fmt(v){return Math.abs(v)&gt;=1e5||(v!==0&amp;&amp;Math.abs(v)&lt;1e-3)?v.toExponential(1):String(+v.toPrecision(3))}<br>function hist(id,arr,m){<br> var c=$(id),g=c.getContext(&#39;2d&#39;),W=c.width,H=c.height,L=10,B=20,n=arr.length,i;<br> g.clearRect(0,0,W,H);<br> var s=arr.slice().sort(function(p,q){return p-q}),lo=s[0],hi=s[Math.floor(n*0.995)];<br> if(!(hi&gt;lo))hi=lo+(Math.abs(lo)||1)*1e-3;<br> var nb=40,bw=(hi-lo)/nb,cnt=[],mx=1;for(i=0;i&lt;nb;i++)cnt.push(0);<br> for(i=0;i&lt;n;i++){if(arr[i]&lt;=hi){var b=Math.min(nb-1,Math.max(0,Math.floor((arr[i]-lo)/bw)));cnt[b]++}}<br> for(i=0;i&lt;nb;i++)if(cnt[i]&gt;mx)mx=cnt[i];<br> var top=mx*1.25,pw=W-L-10,ph=H-B-8;<br> g.fillStyle=css(&#39;--wv&#39;);g.globalAlpha=0.6;<br> for(i=0;i&lt;nb;i++){var h=cnt[i]/top*ph;g.fillRect(L+i*pw/nb+1,H-B-h,pw/nb-2,h)}<br> g.globalAlpha=1;<br> if(m.sd&gt;0){g.strokeStyle=css(&#39;--fit&#39;);g.lineWidth=2.5;g.beginPath();<br>  for(i=0;i&lt;=100;i++){var x=lo+(hi-lo)*i/100,y=n*bw*Math.exp(-0.5*Math.pow((x-m.m)/m.sd,2))/(m.sd*2.5066);<br>   y=Math.min(y,top);var px=L+pw*i/100,py=H-B-y/top*ph;if(i)g.lineTo(px,py);else g.moveTo(px,py)}<br>  g.stroke()}<br> g.fillStyle=css(&#39;--mu&#39;);g.font=&#39;12px sans-serif&#39;;g.fillText(fmt(lo),L,H-5);g.textAlign=&#39;right&#39;;g.fillText(fmt(hi),W-10,H-5);g.textAlign=&#39;left&#39;;<br>}<br>function chain(){<br> var c=$(&#39;c1&#39;),g=c.getContext(&#39;2d&#39;),W=c.width,H=c.height,rec=[],i,x=0,y=0,pts=[[0,0]];<br> trial(rec);g.clearRect(0,0,W,H);<br> for(i=0;i&lt;rec.length;i++){x+=rec[i][0];y+=rec[i][1];pts.push([x,y])}<br> var x0=0,x1=0,y0=0,y1=0;for(i=0;i&lt;pts.length;i++){x0=Math.min(x0,pts[i][0]);x1=Math.max(x1,pts[i][0]);y0=Math.min(y0,pts[i][1]);y1=Math.max(y1,pts[i][1])}<br> var s=Math.min((W-60)/((x1-x0)||1),(H-60)/((y1-y0)||1)),ox=(W-(x1-x0)*s)/2-x0*s,oy=(H+(y1-y0)*s)/2+y0*s;<br> view={x:ox,y:oy,s:s};<br> function P(p){return[ox+p[0]*s,oy-p[1]*s]}<br> for(i=0;i&lt;rec.length;i++){var a=P(pts[i]),b=P(pts[i+1]);g.strokeStyle=rec[i][2]?css(&#39;--pin&#39;):css(&#39;--wv&#39;);g.globalAlpha=rec[i][2]?1:0.6;g.lineWidth=rec[i][2]?4:1.5;g.beginPath();g.moveTo(a[0],a[1]);g.lineTo(b[0],b[1]);g.stroke()}<br> g.globalAlpha=1;var o=P([0,0]),e=P(pts[pts.length-1]);<br> g.strokeStyle=css(&#39;--ink&#39;);g.lineWidth=3;g.beginPath();g.moveTo(o[0],o[1]);g.lineTo(e[0],e[1]);g.stroke();<br> g.fillStyle=css(&#39;--ink&#39;);g.beginPath();g.arc(o[0],o[1],4,0,7);g.fill();g.beginPath();g.arc(e[0],e[1],5,0,7);g.fill();<br>}<br>function classify(){<br> var M=3000,xs=[],i;for(i=0;i&lt;M;i++)xs.push(trial().x);<br> var st=mom(xs),lx=xs.map(function(v){return Math.log(v)}),ls=mom(lx),cv=st.sd/Math.abs(st.m||1e-12),v;<br> if(cv&lt;0.03)v=&#39;Locked: aligned vectors give a nearly fixed result&#39;;<br> else if(ls.sk&gt;1.3||(S.mode==&#39;add&#39;&amp;&amp;st.sk&gt;5))v=&#39;Power-law-like (heavy tail)&#39;;<br> else if(Math.abs(st.sk)&lt;0.25)v=&#39;Normal-like&#39;;<br> else if(Math.abs(ls.sk)&lt;0.35)v=&#39;Log-normal-like&#39;;<br> else if(S.mode==&#39;add&#39;&amp;&amp;ls.sk&lt;-0.3)v=&#39;Rayleigh-like (length of a random walk)&#39;;<br> else v=&#39;Between classes&#39;;<br> return{v:v,xs:xs,lx:lx,st:st,ls:ls,cv:cv};<br>}<br>function draw(){<br> try{<br>  $(&#39;err&#39;).textContent=&#39;&#39;;var r=classify();<br>  $(&#39;v&#39;).textContent=r.v;<br>  $(&#39;info&#39;).textContent=&#39;skew of x: &#39;+fmt(r.st.sk)+&#39;   skew of ln x: &#39;+fmt(r.ls.sk)+&#39;   spread/mean: &#39;+fmt(r.cv);<br>  chain();hist(&#39;c2&#39;,r.xs,r.st);hist(&#39;c3&#39;,r.lx,r.ls);<br> }catch(e){$(&#39;err&#39;).textContent=&#39;Error: &#39;+e.message}<br>}<br>function labels(){$(&#39;vA&#39;).textContent=(+S.al).toFixed(2);$(&#39;vS&#39;).textContent=(+S.sp).toFixed(2)}<br>function bind(id,key){var el=$(id);el.addEventListener(&#39;input&#39;,function(){S[key]=el.type==&#39;range&#39;?+el.value:el.value;labels();draw()})}<br>bind(&#39;mode&#39;,&#39;mode&#39;);bind(&#39;al&#39;,&#39;al&#39;);bind(&#39;sp&#39;,&#39;sp&#39;);<br>$(&#39;cl&#39;).addEventListener(&#39;click&#39;,function(){pinned.length=0;draw()});<br>$(&#39;pl&#39;).addEventListener(&#39;click&#39;,function(){<br> if(timer){clearInterval(timer);timer=null;$(&#39;pl&#39;).textContent=&#39;Play: sweep alignment&#39;;return}<br> $(&#39;pl&#39;).textContent=&#39;Stop&#39;;<br> timer=setInterval(function(){S.al=+S.al+0.02*dir;if(S.al&gt;=1){S.al=1;dir=-1}if(S.al&lt;=0){S.al=0;dir=1}$(&#39;al&#39;).value=S.al;labels();draw()},250)});<br>$(&#39;c1&#39;).addEventListener(&#39;click&#39;,function(e){var c=$(&#39;c1&#39;),r=c.getBoundingClientRect(),k=c.width/r.width,px=(e.clientX-r.left)*k,py=(e.clientY-r.top)*k;<br> pinned.push([(px-view.x)/view.s,-(py-view.y)/view.s]);draw()});<br>labels();draw();<br>})();<br>&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e0cc9396230" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bottlenecks and Elasticities]]></title>
            <link>https://medium.com/@sumit.tripathi/bottleneck-and-elasticities-09fffff141cb?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/09fffff141cb</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 09:22:44 GMT</pubDate>
            <atom:updated>2026-11-27T11:01:21.864Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring the relationships between operations and economics through MMORPG</h4><p>As a kid, I was so drawn into the world of open-world online games with grand settings and communities like Ragnarok Online. The way you can navigate around that world was amazing (still is haha). It was not just the story or the art and architecture or the music that drew me in. It was also the way the communities were built. And looking back it’s quite hard to find something like this. I heard there are many new ones, but I have not followed much so I am definitely not a good judge for this.</p><p>It took me ages to realise the complexity of the community building effort and managing the economy. The game sustained for quite some time because of the meticulous effort to maintain the fine balance in the community and economy. New players don’t feel like it’s too overwhelming while the old/veteran players still feel like there are things to be explored. The gap were still there but it was not too big that people can just spam with pay-to-win schemes. There were aspects of creativity that could let new players explore and still find some new combos that could take down Goliaths of the servers.</p><p>This constant availabilities of new options are what give hopes to both new and veteran players that they could find some new opportunities to out edge the other players. It fuels the excitement and competitiveness in the world. And the concept of options is closely related to the elasticities in microeconomics.</p><p>Let’s review the formula for price elasticities of demand/supply again:</p><blockquote>elasticities = %change in Q / %change in P</blockquote><p>This is closely related to ~ 1/slope. The higher the value the more elastic it is, and the closer it is to 0 the more inelastic it is. You also have the symmetry at 0, therefore the elasticities can also be negative as well depending on the graph we are checking (supply, demand, cross-price, income, etc.). If you look at the demand side, things like a bottle of water could have different prices depending on the availability of options. The more options they have, the more options there would be, which would push the demand curve down. This is why in perfect competition the curve looks flat since there are infinite number of options for us to choose. On the other hand side, if there are no options the curve pushes up and the price can be way higher since there are no options. Hence, the higher slope. One would question that when we have monopoly why does it not become a perfectly inelastic line like in the case of perfect competition. And the reason is that although there are only one seller, the buyer still have another choice — to not buy. Therefore, the elasticity, albeit inelastic, may still not be perfectly inelastic yet.</p><p>From this relationship between options and elasticities, we can see how options can influence the comepetitiveness in the market. In the MMORPG like Ragnarok Online, the options are everywhere, from the jobs, equipment, guilds, drops, items, places, dungeons, etc. All of them provide a level of competitiveness. Creating and crafting something can be made from various materials, or one can buy from NPC (if available) or from other players, or from quests as well. All of these create high-elasticity environment where it becomes more competitive. Now one might say that if elasticity creates competitions we should have them everywhere! And while it might be reasonable to say that, we still have to be careful where the elasticity are.</p><p>And this is where the bottleneck comes in. Imagine a simple bottle of water. In many cases, you would have some sections that are narrow and some that are wider. The idea of bottleneck is that certain section could impact the whole chain of activities or productions. If I want to pour water faster, it would be wise for me to address the narrowest point and widen it a bit rather than widening the already wide section of the bottle, which might yield marginal benefits (provided that the pressure does not break the whole thing).</p><blockquote>Comment 20/11/26 — The pressure in different sections work like Bernoulli’s principle where the adding more in the area with high surface area would get lower overall pressure compared to the part with lower surface area (our bottleneck). Hence the decisions to add something in other areas or segments could indirectly exert pressure on our bottlenecks as well.</blockquote><p>This is very similar to the concept of diminishing returns to an input concept in microeconomics. Our bottleneck reflects the options that we have to address. A very narrow bottleneck signals that in order to improve the capacity, we need to improve the bottleneck and not somewhere else if possible. Hence, the choices to satisfy this need become relatively more limited than I thought, i.e. elasticities drop or this automatically becomes more inelastic — higher curve, which means we would be willing to pay more to solve this issue. Now we could also counterargue that wouldn’t it be better to have no bottleneck, or having a bottle with the exact same width throughout. And this is where the paradox kicks in. In order to reduce the overall bottleneck, we end up making everything a bottleneck! And while on the surface we now have the options to invest or widen any sections further, the subsequent costs mean that the remaining parts become a big bottleneck for us (intersection of all bottlenecks make it rarer than just having one bottleneck).</p><blockquote>In summary the bottleneck — inelastic, other wider regions signal a more elastic regions since the opportunity costs to use those extra capacity are way lower than that of the bottleneck section.</blockquote><blockquote>Comment: This also ties in with the difference between needs/wants with the choices. Our needs/wants could virtually be unlimited, but our choices carry inherent values (like opportunity costs, time, energy, etc.) that would limit and forces us to prioritise better like how we are doing with our bottlenecks.</blockquote><p>Tying this back to the game, we can see that for the platform to manage the flow of new players to become veteran players continuously with little losses and with available resources, would require a combination of value chain from helping them gather raw materials, upskills, creating items, tradings, and building communities based on the available competing resources.</p><p>If the bottleneck is at trading, creating new options for trading would help alleviate the bottleneck. If the bottleneck is at the raw materials level, then creating more options for this would prove worthwhile in managing this bottleneck. This requires us to have visibility of the overall value chains (that may not necessarily be a simple line but could be a complicated pipe systems!) and creating options for the platform. A simple way to do this is to find areas or activities or things, where the price is relatively high or there are lots of demands but not enough supply. That would be a hint that certain could be a bottleneck that may or may not need to be expanded further. Remember our aim may not necessarily be to smoothen the bottleneck(s) but to manage it well or alleviate it so that it becomes easier to manage and have our eyes on (rather than looking at so many bottlenecks at once and trying to manage them all together).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*xr_7Caa2-ZHKN-Et9NJ7Bg.png" /><figcaption>Example of bottleneck and demand &amp; supply as well as elasticities relationships</figcaption></figure><p>In one example that tend to be a big problem for MMORPG to manage the platform in the long-run is how they manage the distributions of the rare goods like cards, rare items, etc. The bottleneck that once becomes a paragon of luxury and status, overtime becomes more and more of a commodity. This requires, them to constantly come up with something exclusive or new or adding a variety to the same thing to make it rarer. For example, new cards, shiny versions or rare versions, limited-edition, expirable goods, etc. to make things rare and in demand or ahead of the curve. Instead of just creating a lot of cards and directly dilute their values, the additional options or add-ons further enhance the rarity while simultaneously create more new options that do not necessarily cannibalise the initial values.</p><p>This inherently suggests that the elasticities and bottleneck can be segmented further into subgroups. Similar to how perfect price discriminations can introduce different prices in order to convert consumer surplus (CS) and Deadweight loss (DWL) to producer surplus (PS). In the same way having different options can generate.</p><blockquote>Note: This also suggests that the segmentations can be in the form of processes / time / things or anything that can further create differentiations. For example, the assembly line of shoes could be made using different processes and segmentation, by tasks, by team size, by materials, by geography, by designs, etc. Each of which could create different kinds of options available to manage.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*rHUmYAzZUV_c7g57yokWxA.png" /><figcaption>Example from Claude</figcaption></figure><p>Each of the section could have different slope or elasticities completely and may not need to be the same curve or functions. The elasticities surplus could look at the elasticities of demand — elasticities of supply at certain quantity or even price as well for each segment (use absolute values if needed for calculation). This will help tell us what the difference in terms of availabilities of options from each side for each segment is. At the equilibrium the slope may not be the same and hence the elasticities could also be different which suggests that the equilbrium of supply and demand can exist even thought there are msmatched in options on the demand and supply sides.</p><blockquote><strong>Update: fixng the above part — last sentence — since the two lines (or more) at the intersection point does not necessarily have the same slopes! Sorry. Additionally I do think that there could be the other equilibrium — the equilibrium of choice that could happen at the point where the abs(slope of Demand) equals slope of Supply or Marginal Demand + Marginal Supply = 0</strong></blockquote><p>Options SurPLUS = Supply’s Elasticities &gt;&gt; absolute |Demand’s Elasticities|</p><p>Options SHORTage = Supply’s Elasticities &lt;&lt; absolute |Demand’s Elasticities|</p><p>From here we can manage the optionalities on either side for different segments. We can add different segments and analyse further as well for each process on the bottleneck chains.</p><blockquote><strong>^^ ***(This part above still needs refining)***</strong></blockquote><p>When one sections or segments have many options that keep on accumulating (think of it like having a lot of money or resources that keep piling up), we may also need to find ways to help them better. Because the starker the contrasts between options across the bottleneck chains, the more we indirectly highlight the bottleneck since the difference becomes big. Therefore, the elasticities shortage and surplus matter as well. In MMORPG the money accumulated easily from drops, selling items, and quests easily balloons up for many players across the time. And this indirectly affect the other aspects in the game. If our bottleneck is certain rare items, that rare items would have higher price as we progress due to inflations of the other area.</p><p>This is akin to the circular flow diagram where we have the money flows from firms to households and viceversa through various activities like trading and taking up jobs. Once certain place tends to receive and accumulates a lot, the other areas start to become bottlenecks, or a bottleneck could emerge somewhere. If the firms decided to keep more of its profit than redistribute back to the workers or partners, the difference creates a bottleneck in which inflations can occur since the flow has been disrupted a bit. In the same manner, the price of rare items in our game becomes more expensive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*MrGyEdrsvNm-4IeMwRy_aw.png" /><figcaption>An example of circular flow diagram from Claude</figcaption></figure><p>One way to address and bring about the equilibrium is to create a sink or drain for excess options or things. Look around us we have perishable goods, things that need to be constantly repaired, upkeep, regular costs, etc. This helps reduce the contrast between the segments and areas. I read the analysis from ChatGPT and it mentions the use of cosmetic purchases like skins, other items that do not directly influence the abilities or create differences in power dynamic but can be used to attract people to spend. This is one of the methods that people can create a drain for maintaining things that create a lot of options like money and bringing about the balance across the game. Remember (once again), our goal is not necessarily to create a uniform bottleneck pipeline since although it seems like the ideal case, they are practically very hard to manage since everything simultaneously becomes a bottleneck. Our aim is to reduce the contrast between segments and creating a curious flavours of uniqueness that further enhances our communities further. And this is not a one time thing since our bottleneck will continuously shift. But once we have the lay of the land of the bottlenecks chains, we would be in a better shape to manage this.</p><p>One of the things that I also found (believe rather haha) is that a profound system is often built on a paradox. The Heisenberg uncertainty principle is a good example. One can get the momentum, but cannot tell where exactly it would be or vice versa. A tradeoffs become inherent in this case since we are dealing directly with bottlenecks and things that are different by nature (things that grow slowly vs. our fast changing desires, etc.). In this manner, we can create balancing mechanisms by taking something that is in abundance to be up for direct trade with something much scarce. This can sound simple like trading abundant money for limited resources, but this can also be expanded to something we automatically assume to be a lot for example the base level of one’s character for some benefits or things. Or trying to create a multi-tier currency where one has more value than the others based on the bottleneck, etc. This could offer a new and unique trading possibilities because we not only look at one thing but have a good view of the things that are abundant in the platform not just the bottlenecks. 有得有失. This would also explain why sometimes we can quickly feel bored when we have all the cheat codes to get all the things. A good game and platform have a good bottleneck management system that makes it engaging. Knowing where our bottlenecks will therefore not only signal our weakness but can also signal where we strategically put our blind spots as well.</p><blockquote>Note: I truly believe that the real-world economy has a lot to learn from this fast-moving digital economy. And that many of their aspects could be replicate to better manage the economy.</blockquote><p>Comment: 26/11/26 — After watching the video on how AI agents can compete with each other for control of the compute, I feel that the bottleneck analysis could be combined with cooperations and survival of the fittest model or game theory as well.</p><p>The model can be the bottlenecks of all the firms combined with the final objective. This is similar to microeconomics diminishing returns to an input concept.</p><p>The idea is that when we have the overall visibility on the entire value chain, we can split the share of each player in each value chains and then identify the overall bottleneck as well as the bottleneck of each player.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*snuYZTqw3km0Yhmh_tFlng.png" /><figcaption>Example of a value chain capacity for 3 firms, represented by different colours — drawn on Canva</figcaption></figure><p>From here, we can map this with the final output. If the final output is the amount produced or the revenues earned, we can optimise our process to better align with the goal since each of the process will have different cost, benefits and values.</p><p>Now combining this with other evolutionary concept and game theory we can now assign strategic decisions to ensure survivals as well as advantages that each player can take to maximise their gains and survivability.</p><p>For example, from the above diagram the red player has bottlenecks at 3 and 5 but abundance in other processes or value chains. To ensure survival, they can trade the capacity of process 2 or 4 with the teal/turquoise/blue (listing all possible colours haha) player or even use their revenues/profits/other resources to trade or expand to ensure survival. These all depend on the opportunity costs or potential benefits. From here they can form alliance or even break the alliance depending on severity of the bottleneck&#39;s issues.</p><p>There is also another key conflict that could arise from the differences in the rate of change between the players’ capacities and the overall system’s capacity that could be much more difficult to scale (similar to the scarcity — resources vs. needs) that we can take into account.</p><p>A way to represent this for analysis could be the %of the total capacity across the value chains along with the multipliers on the things that are scarcer or are the bottlenecks. The player can choose different strategy for each stage of the value chains — cooperating, competing, dominant. etc. Each player has different incentives to choose things that are best for them similar to game theory, but once we intersect the choices of all the players, different strategies and scenarios could emerge which could shape the landscape. Since there are many players, it would be better to use matrix to represent this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*pjG8lEvTW_G58v2TbG4F_g.png" /></figure><p>An example value of the capacity. These values represent the overcapacity in the industry of each player (A,B &amp;C) across 6 value chains. If the processes start from process 1 to 6 and the smallest value represent the overall capacity for each firm or the bottleneck for each player, then we can build the cooperation/competition strategy from this. For player C whose bottleneck is 30% in process/value #3 then C can either continue competing with A or B or choose to cooperate with A or B to eliminate the others. And this value chain also has a cascading effect on the subsequent processes on the chain as well, so we can use opportunity costs or to find the best outcome that helps each player achieve its goal. This needs to be refined further, and I find a lot of potential in using this to understand how cooperations could unfold at a deeper level than just looking at the final outcome since it could give us the glimpse of the things each player has to prioritise.</p><p>27/11/26 — the bottleneck charts above need not have all players across all value chains or need every players to have all ingredients, therefore the colour shades may not be continuous for a player from end-to-end. We can also extend the pipeline to have different kinds of circuits or piping system depending on our value chains or ingredients / factors requirements. Or it can even be a cycle/cycles/complex or multiple loops like the circular flow diagram in economics study.</p><p>We can also replace the value chain stages with the availablty of choices in each stages as well.</p><p>Note: Optimisation n ths context wll be to manage the pipeline based on the existing resources or conditions. vs. Growth is to expand the pipeline capacity or output</p><p>Additionally, we can also convert this to a board game to help us better understand how strategies work and how different market competitions form from this concept.</p><p>Here, we can let each user (in the same industry, environment, food chains, natural habitats, microbes, planets, etc.) where we all compete for dominance or compete for survival through competitions or cooperations. There will be 3 types of cards, environment infrastructure (overall capacity), our infrastructure (our capacity), random event cards. Each player can use these cards to build the overall supply chain pipeline along with other players and taking control of the pipeline share across different sections. The random events cards get trigger when there are disputes that are unresolvable among players or after each round where player draws new sets of cards (3 each round). The goal is to ensure survival and maximise the gain in the pipeline.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09fffff141cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Los Números Primos con Overtones y Undertones]]></title>
            <link>https://medium.com/@sumit.tripathi/los-n%C3%BAmeros-primos-con-overtones-y-undertones-5005b406c5ca?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5005b406c5ca</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 15:33:38 GMT</pubDate>
            <atom:updated>2026-11-18T03:06:53.456Z</atom:updated>
            <content:encoded><![CDATA[<h4>Experimentando con las notas con frecuencias diferentes</h4><p>Mi hípotesis es que quizás podemos entender los números primos mejor usando las octavas o algo con ciclos como en la música. Pero no podía comprobar aún, entonces usamos los undertones y overtones diferentes para comparar más.</p><blockquote>Comentario: Antes quería entender si cuando toco una nota y la otra T segundo/milisegundo más cuál sería su diferente en su tono pero la frecuencia no cambia sólo la fase cambia — lo he entendido muy lentamente jaja. He descubrido que ya hay Helmholtz que tuvo este experimento para entender este efect el siglo 19.</blockquote><p>Los datos:</p><pre>   OVERTONES  n·f   (n = 1..64)   ★ = prime n<br>  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br>    n     freq (Hz)         12-TET        24-TET        31-TET        41-TET        53-TET        72-TET   prime<br>  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br>    1       440.000       A3(  -0)      A3(  -0)      A3( +10)      A3(  -7)      A3(  -6)      A3(  -0)    <br>    2       880.000       A4(  -0)      A4(  -0)      A4( +10)      A4(  -7)      A4(  -6)      A4(  -0)   ★<br>    3      1320.000       E5(  +2)      E5(  +2)      E5( +15)      E5(  -8)      E5(  -6)      E5(  +2)   ★<br>    4      1760.000       A5(  -0)      A5(  -0)      A5( +10)      A5(  -7)      A5(  -6)      A5(  -0)    <br>    5      2200.000      C#6( -14)     C#6( -14)     C#6(  +9)     C#6(  -1)     C#6(  -4)     C#6(  +3)   ★<br>    6      2640.000       E6(  +2)      E6(  +2)      E6( +15)      E6(  -8)      E6(  -6)      E6(  +2)    <br>    7      3080.000       G6( -31)    F#↑6( +19)     G↓6( +11)     G↓6(  -4)      G6( -10)     G↓6(  +2)   ★<br>    8      3520.000       A6(  -0)      A6(  -0)      A6( +10)      A6(  -7)      A6(  -6)      A6(  -0)    <br>    9      3960.000       B6(  +4)      B6(  +4)      B6( -19)      B6(  -8)      B6(  -6)      B6(  +4)    <br>   10      4400.000      C#7( -14)     C#7( -14)     C#7(  +9)     C#7(  -1)     C#7(  -4)     C#7(  +3)    <br>   11      4840.000      D#7( -49)     D↑7(  +1)     D↑7( +19)    D#↓7( -12)     D↑7(  +2)    D#↓7(  +1)   ★<br>   12      5280.000       E7(  +2)      E7(  +2)      E7( +15)      E7(  -8)      E7(  -6)      E7(  +2)    <br>   13      5720.000       F7( +41)    F#↓7(  -9)     F↑7(  -1)     F↑7( +14)     F↑7(  -3)     F↑7(  +7)   ★<br>   14      6160.000       G7( -31)    F#↑7( +19)     G↓7( +11)     G↓7(  -4)      G7( -10)     G↓7(  +2)    <br>   15      6600.000      G#7( -12)     G#7( -12)    G#↓7( +14)     G#7(  -2)     G#7(  -4)     G#7(  +5)    <br>   16      7040.000       A7(  -0)      A7(  -0)      A7( +10)      A7(  -7)      A7(  -6)      A7(  -0)    <br>   17      7480.000      A#7(  +5)     A#7(  +5)     A#7(  -1)     A#7( +10)     A#7(  +9)     A#7(  +5)   ★<br>   18      7920.000       B7(  +4)      B7(  +4)      B7( -19)      B7(  -8)      B7(  -6)      B7(  +4)    <br>   19      8360.000       C8(  -2)      C8(  -2)      C8(  -2)      C8(  -2)      C8(  -2)      C8(  -2)   ★<br>   20      8800.000      C#8( -14)     C#8( -14)     C#8(  +9)     C#8(  -1)     C#8(  -4)     C#8(  +3)    <br>   21      9240.000       D8( -29)     D↓8( +21)     D↓8( +16)      D8(  -5)      D8( -10)     D↓8(  +4)    <br>   22      9680.000      D#8( -49)     D↑8(  +1)     D↑8( +19)    D#↓8( -12)     D↑8(  +2)    D#↓8(  +1)    <br>   23     10120.000      D#8( +28)     E↓8( -22)     D#8( +19)     D#8(  +6)     D#8( +11)    D#↑8(  -5)   ★<br>   24     10560.000       E8(  +2)      E8(  +2)      E8( +15)      E8(  -8)      E8(  -6)      E8(  +2)    <br>   25     11000.000       F8( -27)     E↑8( +23)     F↓8(  +8)     F↓8(  +4)      F8(  -3)     F↓8(  +6)    <br>   26     11440.000       F8( +41)    F#↓8(  -9)     F↑8(  -1)     F↑8( +14)     F↑8(  -3)     F↑8(  +7)    <br>   27     11880.000      F#8(  +6)     F#8(  +6)     F#8( -13)     F#8(  -9)     F#8(  -5)     F#8(  +6)    <br>   28     12320.000       G8( -31)    F#↑8( +19)     G↓8( +11)     G↓8(  -4)      G8( -10)     G↓8(  +2)    <br>   29     12760.000       G8( +30)    G#↓8( -20)     G↑8(  -6)     G↑8(  -2)      G8(  +5)     G↑8(  -4)   ★<br>   30     13200.000      G#8( -12)     G#8( -12)    G#↓8( +14)     G#8(  -2)     G#8(  -4)     G#8(  +5)    <br>   31     13640.000      G#8( +45)    G#↑8(  -5)     A↓8(  -7)    G#↑8(  -4)    G#↑8(  +7)     A↓8(  -5)   ★<br>   32     14080.000       A8(  -0)      A8(  -0)      A8( +10)      A8(  -7)      A8(  -6)      A8(  -0)    <br>   33     14520.000      A#8( -47)    A#↓8(  +3)    A#↓8( -14)    A#↓8( -13)    A#↓8(  +2)    A#↓8(  +3)    <br>   34     14960.000      A#8(  +5)     A#8(  +5)     A#8(  -1)     A#8( +10)     A#8(  +9)     A#8(  +5)    <br>   35     15400.000       B8( -45)    A#↑8(  +5)    A#↑8( +10)     B↓8(  +1)     B↓8(  -9)    A#↑8(  +5)    <br>   36     15840.000       B8(  +4)      B8(  +4)      B8( -19)      B8(  -8)      B8(  -6)      B8(  +4)    <br>   37     16280.000       C9( -49)     C↓8(  +1)     C↓8( -10)     B↑8( +10)     C↓8(  -3)     C↓8(  +1)   ★<br>   38     16720.000       C9(  -2)      C9(  -2)      C9(  -2)      C9(  -2)      C9(  -2)      C9(  -2)    <br>   39     17160.000       C9( +42)     C↑9(  -8)     C↑9(  +4)     C↑9( +13)     C↑9(  -3)     C↑9(  -8)    <br>   40     17600.000      C#9( -14)     C#9( -14)     C#9(  +9)     C#9(  -1)     C#9(  -4)     C#9(  +3)    <br>   41     18040.000      C#9( +29)     D↓9( -21)     C#9( +13)     C#9( +12)    C#↑9(  -7)    C#↑9(  -4)   ★<br>   42     18480.000       D9( -29)     D↓9( +21)     D↓9( +16)      D9(  -5)      D9( -10)     D↓9(  +4)    <br>   43     18920.000       D9( +12)      D9( +12)      D9( +18)      D9(  +7)      D9(  +8)      D9(  -5)   ★<br>   44     19360.000      D#9( -49)     D↑9(  +1)     D↑9( +19)    D#↓9( -12)     D↑9(  +2)    D#↓9(  +1)    <br>   45     19800.000      D#9( -10)     D#9( -10)    D#↓9( +19)     D#9(  -2)     D#9(  -4)     D#9(  +7)    <br>   46     20240.000      D#9( +28)     E↓9( -22)     D#9( +19)     D#9(  +6)     D#9( +11)    D#↑9(  -5)    <br>   47     20680.000       E9( -34)     E↓9( +16)    D#↑9( +17)     E↓9( +14)     E↓9(  +3)     E↓9(  -1)   ★<br>   48     21120.000       E9(  +2)      E9(  +2)      E9( +15)      E9(  -8)      E9(  -6)      E9(  +2)    <br>   49     21560.000       E9( +38)     E↑9( -12)     E↑9( +12)     E↑9(  -1)     E↑9(  +7)     E↑9(  +4)    <br>   50     22000.000       F9( -27)     E↑9( +23)     F↓9(  +8)     F↓9(  +4)      F9(  -3)     F↓9(  +6)    <br>   51     22440.000       F9(  +7)      F9(  +7)      F9(  +4)      F9(  +9)      F9(  +9)      F9(  +7)    <br>   52     22880.000       F9( +41)    F#↓9(  -9)     F↑9(  -1)     F↑9( +14)     F↑9(  -3)     F↑9(  +7)    <br>   53     23320.000      F#9( -26)    F#↓9( +24)     F#9(  -7)     F#9( -12)    F#↓9(  +7)    F#↓9(  +7)   ★<br>   54     23760.000      F#9(  +6)     F#9(  +6)     F#9( -13)     F#9(  -9)     F#9(  -5)     F#9(  +6)    <br>   55     24200.000      F#9( +38)    F#↑9( -12)     F#9( +18)    F#↑9(  -6)    F#↑9(  +4)    F#↑9(  +4)    <br>   56     24640.000       G9( -31)    F#↑9( +19)     G↓9( +11)     G↓9(  -4)      G9( -10)     G↓9(  +2)    <br>   57     25080.000       G9(  -1)      G9(  -1)      G9(  +3)      G9(  -3)      G9(  -2)      G9(  -1)    <br>   58     25520.000       G9( +30)    G#↓9( -20)     G↑9(  -6)     G↑9(  -2)      G9(  +5)     G↑9(  -4)    <br>   59     25960.000      G#9( -41)    G#↓9(  +9)    G#↓9( -15)    G#↓9(  -2)    G#↓9( -11)    G#↓9(  -7)   ★<br>   60     26400.000      G#9( -12)     G#9( -12)    G#↓9( +14)     G#9(  -2)     G#9(  -4)     G#9(  +5)    <br>   61     26840.000      G#9( +17)     G#9( +17)     G#9(  +4)     G#9(  -3)     G#9(  +2)     G#9(  +0)   ★<br>   62     27280.000      G#9( +45)    G#↑9(  -5)     A↓9(  -7)    G#↑9(  -4)    G#↑9(  +7)     A↓9(  -5)    <br>   63     27720.000       A9( -27)    G#↑9( +23)      A9( -18)      A9(  -5)      A9( -10)     A↓9(  +6)    <br>   64     28160.000       A9(  -0)      A9(  -0)      A9( +10)      A9(  -7)      A9(  -6)      A9(  -0)</pre><pre>   UNDERTONES  f/n  (n = 1..64)   ★ = prime n<br>  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br>    n     freq (Hz)         12-TET        24-TET        31-TET        41-TET        53-TET        72-TET   prime<br>  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────<br>    1       440.000       A3(  -0)      A3(  -0)      A3( +10)      A3(  -7)      A3(  -6)      A3(  -0)    <br>    2       220.000       A2(  -0)      A2(  -0)      A2( +10)      A2(  -7)      A2(  -6)      A2(  -0)   ★<br>    3       146.667       D2(  -2)      D2(  -2)      D2(  +4)      D2(  -7)      D2(  -6)      D2(  -2)   ★<br>    4       110.000       A1(  -0)      A1(  -0)      A1( +10)      A1(  -7)      A1(  -6)      A1(  -0)    <br>    5        88.000       F1( +14)      F1( +14)      F1( +10)     F↑1( -13)      F1(  -7)      F1(  -3)   ★<br>    6        73.333       D1(  -2)      D1(  -2)      D1(  +4)      D1(  -7)      D1(  -6)      D1(  -2)    <br>    7        62.857       B0( +31)     C↓0( -19)      B0(  +9)     B↑0( -10)     B↑0(  -1)     B↑0(  -2)   ★<br>    8        55.000       A0(  -0)      A0(  -0)      A0( +10)      A0(  -7)      A0(  -6)      A0(  -0)    <br>    9        48.889       G0(  -4)      G0(  -4)      G0(  -1)      G0(  -6)      G0(  -6)      G0(  -4)    <br>   10        44.000       F0( +14)      F0( +14)      F0( +10)     F↑0( -13)      F0(  -7)      F0(  -3)    <br>   11        40.000      D#0( +49)     E↓0(  -1)    D#↑0(  +0)     E↓0(  -3)    D#↑0(  +9)     E↓0(  -1)   ★<br>   12        36.667       D0(  -2)      D0(  -2)      D0(  +4)      D0(  -7)      D0(  -6)      D0(  -2)    <br>   13        33.846      C#0( -41)     C↑0(  +9)     C#0( -18)    C#↓0(  +1)    C#↓0(  -8)    C#↓0(  -7)   ★<br>   14        31.429      B-1( +31)    C↓-1( -19)     B-1(  +9)    B↑-1( -10)    B↑-1(  -1)    B↑-1(  -2)    <br>   15        29.333     A#-1( +12)    A#-1( +12)    A#-1(  +5)    A#-1( -13)    A#-1(  -7)    A#-1(  -5)    <br>   16        27.500      A-1(  -0)     A-1(  -0)     A-1( +10)     A-1(  -7)     A-1(  -6)     A-1(  -0)    <br>   17        25.882     G#-1(  -5)    G#-1(  -5)    G#-1( -18)    G#-1(  +5)    G#-1(  +3)    G#-1(  -5)   ★<br>   18        24.444      G-1(  -4)     G-1(  -4)     G-1(  -1)     G-1(  -6)     G-1(  -6)     G-1(  -4)    <br>   19        23.158     F#-1(  +2)    F#-1(  +2)    F#-1( -17)    F#-1( -12)    F#-1(  -9)    F#-1(  +2)   ★<br>   20        22.000      F-1( +14)     F-1( +14)     F-1( +10)    F↑-1( -13)     F-1(  -7)     F-1(  -3)    <br>   21        20.952      E-1( +29)    E↑-1( -21)    E↑-1(  +3)    E↑-1( -10)    E↑-1(  -1)    E↑-1(  -4)    <br>   22        20.000     D#-1( +49)    E↓-1(  -1)   D#↑-1(  +0)    E↓-1(  -3)   D#↑-1(  +9)    E↓-1(  -1)    <br>   23        19.130     D#-1( -28)    D↑-1( +22)   D#↓-1(  +1)   D#↓-1(  +8)   D#↓-1(  +0)   D#↓-1(  +5)   ★<br>   24        18.333      D-1(  -2)     D-1(  -2)     D-1(  +4)     D-1(  -7)     D-1(  -6)     D-1(  -2)    <br>   25        17.600     C#-1( +27)    D↓-1( -23)    C#-1( +11)    C#-1( +10)   C#↑-1(  -8)   C#↑-1(  -6)    <br>   26        16.923     C#-1( -41)    C↑-1(  +9)    C#-1( -18)   C#↓-1(  +1)   C#↓-1(  -8)   C#↓-1(  -7)    <br>   27        16.296      C-1(  -6)     C-1(  -6)     C-1(  -6)     C-1(  -6)     C-1(  -6)     C-1(  -6)    <br>   28        15.714      B-2( +31)    C↓-2( -19)     B-2(  +9)    B↑-2( -10)    B↑-2(  -1)    B↑-2(  -2)    <br>   29        15.172      B-2( -30)   A#↑-2( +20)     B-2( -13)     B-2( -13)    B↓-2(  +6)    B↓-2(  +4)   ★<br>   30        14.667     A#-2( +12)    A#-2( +12)    A#-2(  +5)    A#-2( -13)    A#-2(  -7)    A#-2(  -5)    <br>   31        14.194     A#-2( -45)   A#↓-2(  +5)   A#↓-2( -13)   A#↓-2( -11)   A#↓-2(  +4)   A#↓-2(  +5)   ★<br>   32        13.750      A-2(  -0)     A-2(  -0)     A-2( +10)     A-2(  -7)     A-2(  -6)     A-2(  -0)    <br>   33        13.333     G#-2( +47)   G#↑-2(  -3)    A↓-2(  -5)   G#↑-2(  -2)   G#↑-2(  +9)    A↓-2(  -3)    <br>   34        12.941     G#-2(  -5)    G#-2(  -5)    G#-2( -18)    G#-2(  +5)    G#-2(  +3)    G#-2(  -5)    <br>   35        12.571      G-2( +45)   G#↓-2(  -5)    G↑-2(  +9)    G↑-2( +13)    G↑-2(  -2)   G#↓-2(  -5)    <br>   36        12.222      G-2(  -4)     G-2(  -4)     G-2(  -1)     G-2(  -6)     G-2(  -6)     G-2(  -4)    <br>   37        11.892     F#-2( +49)   F#↑-2(  -1)    G↓-2(  -9)   F#↑-2(  +5)    G↓-2(  -8)   F#↑-2(  -1)   ★<br>   38        11.579     F#-2(  +2)    F#-2(  +2)    F#-2( -17)    F#-2( -12)    F#-2(  -9)    F#-2(  +2)    <br>   39        11.282     F#-2( -42)   F#↓-2(  +8)    F↑-2( +16)   F#↓-2(  +1)   F#↓-2(  -9)   F#↓-2(  +8)    <br>   40        11.000      F-2( +14)     F-2( +14)     F-2( +10)    F↑-2( -13)     F-2(  -7)     F-2(  -3)    <br>   41        10.732      F-2( -29)    E↑-2( +21)    F↓-2(  +6)    F↓-2(  +3)     F-2(  -5)    F↓-2(  +4)   ★<br>   42        10.476      E-2( +29)    E↑-2( -21)    E↑-2(  +3)    E↑-2( -10)    E↑-2(  -1)    E↑-2(  -4)    <br>   43        10.233      E-2( -12)     E-2( -12)     E-2(  +1)     E-2(  +8)     E-2(  +4)     E-2(  +5)   ★<br>   44        10.000     D#-2( +49)    E↓-2(  -1)   D#↑-2(  +0)    E↓-2(  -3)   D#↑-2(  +9)    E↓-2(  -1)    <br>   45         9.778     D#-2( +10)    D#-2( +10)    D#-2(  +0)    D#-2( -12)    D#-2(  -7)    D#-2(  -7)    <br>   46         9.565     D#-2( -28)    D↑-2( +22)   D#↓-2(  +1)   D#↓-2(  +8)   D#↓-2(  +0)   D#↓-2(  +5)    <br>   47         9.362      D-2( +34)    D↑-2( -16)    D↑-2(  +2)    D↑-2(  +0)    D↑-2(  +8)    D↑-2(  +1)   ★<br>   48         9.167      D-2(  -2)     D-2(  -2)     D-2(  +4)     D-2(  -7)     D-2(  -6)     D-2(  -2)    <br>   49         8.980      D-2( -38)    D↓-2( +12)    D↓-2(  +8)     D-2( -13)    D↓-2(  +4)    D↓-2(  -4)    <br>   50         8.800     C#-2( +27)    D↓-2( -23)    C#-2( +11)    C#-2( +10)   C#↑-2(  -8)   C#↑-2(  -6)    <br>   51         8.627     C#-2(  -7)    C#-2(  -7)    C#-2( +16)    C#-2(  +5)    C#-2(  +3)    C#-2(  -7)    <br>   52         8.462     C#-2( -41)    C↑-2(  +9)    C#-2( -18)   C#↓-2(  +1)   C#↓-2(  -8)   C#↓-2(  -7)    <br>   53         8.302      C-2( +26)    C↑-2( -24)    C↑-2( -12)    C↑-2(  -3)     C-2(  +4)    C↑-2(  -7)   ★<br>   54         8.148      C-2(  -6)     C-2(  -6)     C-2(  -6)     C-2(  -6)     C-2(  -6)     C-2(  -6)    <br>   55         8.000      C-2( -38)    C↓-3( +12)    C↓-3(  +1)    C↓-3(  -8)    C↓-3(  +8)    C↓-3(  -4)    <br>   56         7.857      B-3( +31)    C↓-3( -19)     B-3(  +9)    B↑-3( -10)    B↑-3(  -1)    B↑-3(  -2)    <br>   57         7.719      B-3(  +1)     B-3(  +1)     B-3( +17)     B-3( -12)     B-3(  -9)     B-3(  +1)    <br>   58         7.586      B-3( -30)   A#↑-3( +20)     B-3( -13)     B-3( -13)    B↓-3(  +6)    B↓-3(  +4)    <br>   59         7.458     A#-3( +41)   A#↑-3(  -9)   A#↑-3(  -4)    B↓-3( -13)   A#↑-3(  -1)   A#↑-3(  +7)   ★<br>   60         7.333     A#-3( +12)    A#-3( +12)    A#-3(  +5)    A#-3( -13)    A#-3(  -7)    A#-3(  -5)    <br>   61         7.213     A#-3( -17)    A#-3( -17)   A#↓-3( +15)    A#-3( -12)   A#↓-3( +10)    A#-3(  -0)   ★<br>   62         7.097     A#-3( -45)   A#↓-3(  +5)   A#↓-3( -13)   A#↓-3( -11)   A#↓-3(  +4)   A#↓-3(  +5)    <br>   63         6.984      A-3( +27)   A#↓-3( -23)    A↑-3(  -2)    A↑-3(  -9)    A↑-3(  -1)    A↑-3(  -6)    <br>   64         6.875      A-3(  -0)     A-3(  -0)     A-3( +10)     A-3(  -7)     A-3(  -6)     A-3(  -0)</pre><p>La serie de las notas primas</p><p>Overtones:</p><ul><li>12-TET: A — E — C# — G — D# — F — A# — C — D# — G — G# — C — C# — D — E — F# — G# … etc.</li><li>24-TET: A — E — C# — F#↑ — D↑ — F#↓ — A# — C — E↓ — G#↓ — G#↑ — C↓ — D↓ — D — E↓ — F#↓ — G# … etc.</li><li>etc.</li></ul><p>Undertones:</p><ul><li>12-TET: A — D — F — B — D# — C# — G# — F# — D# — B — A# — F# — F — E — D — C — A# — A# … etc.</li><li>24-TET: A — D — F — C↓ — E↓ — C↑ — G# — F# — D↑ — A#↑ — A#↓ — F#↑ — E↑ — E — D↑ — C↑ — A#↑ — A# …etc.</li><li>etc.</li></ul><p>Si conectamos las notas de overtones y undertones juntos, tendríamos (A,A), (E,D), (C#,F), (G,B), etc. (por 12-TET) y etc.</p><p>Además los GCD de las notas en general podría darnos unas intervales que son muy distintas de cada valor de GCD??</p><p>Por ejemplo</p><ul><li>si el GCD es 2 o 2^n, la interval sería en la forma de la octava en ambas caso (undertone y overtone).</li><li>si el GCD es 3, la interval sería 6 semitonos (B,F#) / (G,C) ??</li><li>etc.</li></ul><p>Pero en este caso el GCD es un poco especial y lo necesitamos usar el formulario diferente para entender mejor porque cuando comparamos overtones 10 y 12 o undertones 10 y 12, la interval sería (C#,E) y (F,D) respectivamente — o la interval de 4 semitonos pero el GCD es 2. Pero cuando comparamos overtones 12 y 14 o undertones 12 y 14, la interval sería (E,G) y (D,B) respectivamente — o la interval de 4 semitonos también.</p><p>El nuevo formulario de GCD en este contexto sería:</p><p>GCD(n1,n2) = ~log2(n1/n2) * mod (n-TET) ; n es el número de las notas en una octava y m es el número de overtone/undertone primero??? (he usado la IA para ayudar)</p><blockquote>Por la referencia: una nota de n-TET = n * log2(n2/n1)</blockquote><blockquote>y cents entre dos notas = 1200 * log2(n1/n2)</blockquote><p>No estoy seguro aún — especialmente si tuvieramos más de unas notas, cómo podríamos calcular las intervales??</p><p>Muy interesante!</p><blockquote>Comentario 18/11/26: sería igual importante para calcular LCM de este método también. No lo sé cómo podemos calcularlo aún.</blockquote><p>Un intento de resolver usando la IA. El mínimo número o nota que ambas notas tiene en común.</p><p>LCM (n1,n2) = n1*n2 / GCD(n1,n2)</p><p>Entonces LCM(n1,n2) = ~ (n1*n2/ log2(n1/n2)) mod (n-TET) ?</p><p>Este tipo de problema es muy parecido como ‘Derivativos de módulos**’</p><pre>&quot;&quot;&quot;<br>overtone_undertone_explorer.py<br>Full multi-EDO version — 12, 24, 31, 41, 53, 72-TET columns.<br><br>Inputs (text boxes at top):<br>  • Base note/freq  : A4, C#3, Eb2, 440, 261.63<br>  • N (max n)       : 1..500<br><br>Features:<br>  • Piano (A0..C8), click to add notes<br>  • Auto-fill overtones / undertones / prime-only<br>  • Per-note Δ ms (time-shift) preserved<br>  • Waveform + envelope, steady FFT, spectrogram<br>  • FFT marker lines: orange = overtone, purple = undertone,<br>                       bold = prime n<br>  • Console print: full overtone/undertone table with ALL EDO columns<br>  • Console print: cents-between-consecutive table with EDO landing<br>  • Console print: 24/31/41/53/72-TET reference grids<br><br>Requires: numpy, matplotlib, scipy ; optional sounddevice for audio<br>&quot;&quot;&quot;<br><br>import numpy as np<br>import matplotlib.pyplot as plt<br>from matplotlib.widgets import Slider, Button, TextBox<br>from matplotlib.patches import Rectangle<br>from scipy.io import wavfile<br>try:<br>    import sounddevice as sd<br>    HAVE_AUDIO = True<br>except Exception:<br>    HAVE_AUDIO = False<br><br>SR = 44100<br>NOTE_NAMES = [&quot;C&quot;,&quot;C#&quot;,&quot;D&quot;,&quot;D#&quot;,&quot;E&quot;,&quot;F&quot;,&quot;F#&quot;,&quot;G&quot;,&quot;G#&quot;,&quot;A&quot;,&quot;A#&quot;,&quot;B&quot;]<br>BLACK = {&quot;C#&quot;,&quot;D#&quot;,&quot;F#&quot;,&quot;G#&quot;,&quot;A#&quot;}<br><br># ══════════════════════════════════════════════════════════════════════════════<br>#   EDO (Equal Divisions of the Octave) definitions<br># ══════════════════════════════════════════════════════════════════════════════<br><br># Each EDO spec: (divisions, name-array-builder, spacing-in-12-TET-steps for label)<br># We use the convention: step 0 = C, and each step adds 1200/divisions cents.<br># Names are generated by: base note + optional accidental + up/down arrow.<br><br>EDO_LIST = [12, 24, 31, 41, 53, 72]<br><br>def _edo_arrow_notation(step, divisions):<br>    &quot;&quot;&quot;<br>    Name a step in a given EDO using nearest 12-TET note + arrow notation.<br>    - For EDOs that are multiples of 12 (12, 24, 72), use integer positions.<br>    - For others, use the nearest 12-TET note plus ↑ / ↓ arrows indicating<br>      how many 12-TET-comma-ish deviations are needed.<br>    We use a *pragmatic* naming: compute cents, then:<br>      • nearest 12-TET note as base<br>      • deviation d in [-50, +50] cents<br>      • express deviation as a fraction of a quarter-tone (50c):<br>          • |d| &lt; 8¢   → plain note (e.g. &#39;C4&#39;)<br>          • |d| &lt; 33¢  → quarter-tone arrow (↑/↓)   (like 24-TET)<br>          • |d| &lt; 58¢  → (won&#39;t happen in [-50,50])<br>      • For fine systems (&gt;24 divisions), add arrows for sub-quarter-tone<br>        deviation, e.g. &#39;↑↑&#39; for a sharp deviation of 25-40¢.<br>    &quot;&quot;&quot;<br>    # deviation of step from C0 in cents<br>    cents = step * (1200.0 / divisions)<br>    # nearest 12-TET MIDI note (as float)<br>    midi = cents / 100.0   # 0 = C-1, 69 = A4 (which is 6900c above C-1)<br>    nearest = int(round(midi))<br>    dev = cents - 100.0 * nearest   # in [-50, +50]<br>    base_name = NOTE_NAMES[nearest % 12]<br>    octave = nearest // 12 - 1<br><br>    # express dev with arrows<br>    aq = dev / 50.0          # in &quot;quarter tones&quot; (0.5 = semitone)<br>    # number of arrows (0..2)<br>    n_arrows = int(round(abs(aq)))    # 0, 1, or 2<br>    if n_arrows == 0:<br>        return f&quot;{base_name}{octave}&quot;<br>    arrow = &quot;↑&quot; if dev &gt; 0 else &quot;↓&quot;<br>    return f&quot;{base_name}{arrow*n_arrows}{octave}&quot;<br><br>def edo_name(step, divisions):<br>    &quot;&quot;&quot;Return just the note name (with arrow symbols) for the given step.&quot;&quot;&quot;<br>    return _edo_arrow_notation(step % divisions, divisions)<br><br>def freq_to_edo_note(f, divisions, a4=440.0):<br>    &quot;&quot;&quot;<br>    Return (name-with-octave, cents-deviation) for the given EDO divisions.<br>    Convention: A4 = 440 Hz. A4 is 9 semitones above C4.<br>    &quot;&quot;&quot;<br>    if f &lt;= 0:<br>        return (&quot;—&quot;, 0)<br>    # absolute step from C-1 in this EDO<br>    steps_float = divisions * np.log2(f / 16.3516)   # C-1 ≈ 16.3516 Hz<br>    steps_int = int(round(steps_float))<br>    # cents deviation from that EDO step<br>    cents_per_step = 1200.0 / divisions<br>    dev = cents_per_step * (steps_float - steps_int)<br>    # name<br>    octave = steps_int // divisions - 1<br>    idx = steps_int % divisions<br>    # base 12-TET note for this step (nearest)<br>    name = _edo_arrow_notation(idx, divisions)<br>    # drop octave from _edo_arrow_notation and reattach (it may differ)<br>    # simplest: rebuild name with correct octave<br>    cents = idx * cents_per_step<br>    midi_in_oct = cents / 100.0<br>    near12 = int(round(midi_in_oct))<br>    dev12 = cents - 100.0 * near12<br>    base_nm = NOTE_NAMES[near12 % 12]<br>    n_ar = int(round(abs(dev12) / 50.0))<br>    if n_ar == 0:<br>        label = base_nm<br>    else:<br>        arrow = &quot;↑&quot; if dev12 &gt; 0 else &quot;↓&quot;<br>        label = f&quot;{base_nm}{arrow*n_ar}&quot;<br>    return (f&quot;{label}{octave}&quot;, dev)<br><br>def fmt_edo_cell(f, divisions):<br>    &quot;&quot;&quot;Compact &#39;name(dev)&#39; string for table cells.&quot;&quot;&quot;<br>    name, dev = freq_to_edo_note(f, divisions)<br>    return f&quot;{name:&gt;6}({dev:+4.0f})&quot;<br><br># ══════════════════════════════════════════════════════════════════════════════<br>#   Note math helpers<br># ══════════════════════════════════════════════════════════════════════════════<br><br>def note_to_freq(name, octave, a4=440.0):<br>    n = NOTE_NAMES.index(name) + (octave - 4) * 12 - 9<br>    return a4 * 2 ** (n / 12)<br><br>def freq_to_note(f, a4=440.0):<br>    if f &lt;= 0: return (&quot;—&quot;, 0)<br>    n = 12 * np.log2(f / a4) + 69<br>    nr = int(round(n)); cents = 100 * (n - nr)<br>    return (f&quot;{NOTE_NAMES[nr % 12]}{nr//12 - 1}&quot;, cents)<br><br>def is_prime(n):<br>    if n &lt; 2: return False<br>    if n &lt; 4: return True<br>    if n % 2 == 0: return False<br>    i = 3<br>    while i*i &lt;= n:<br>        if n % i == 0: return False<br>        i += 2<br>    return True<br><br>def parse_base(s):<br>    s = s.strip()<br>    if not s: return None<br>    try:<br>        return (float(s), f&quot;{float(s):.2f} Hz&quot;)<br>    except ValueError:<br>        pass<br>    name = s[:-1] if s[-1].isdigit() else s<br>    name = name.replace(&quot;♯&quot;,&quot;#&quot;).replace(&quot;♭&quot;,&quot;B&quot;).upper()<br>    octave = int(s[-1]) if s[-1].isdigit() else 4<br>    if name not in NOTE_NAMES: return None<br>    return (note_to_freq(name, octave), f&quot;{name}{octave}&quot;)<br><br>def parse_n(s, default=64):<br>    try:<br>        n = int(float(s))<br>        return max(1, min(n, 500))<br>    except Exception:<br>        return default<br><br># ══════════════════════════════════════════════════════════════════════════════<br>#   Synthesis &amp; analysis<br># ══════════════════════════════════════════════════════════════════════════════<br><br>def synth(freq, start, dur, amp, total):<br>    t = np.arange(int(total * SR)) / SR<br>    out = np.zeros_like(t)<br>    mask = t &gt;= start<br>    lt = t[mask] - start<br>    env = np.ones_like(lt)<br>    a, r = int(0.005*SR), int(0.03*SR)<br>    if len(env) &gt; a: env[:a] = np.linspace(0, 1, a)<br>    if len(env) &gt; r: env[-r:] *= np.linspace(1, 0, r)<br>    cut = int(dur * SR)<br>    if cut &lt; len(lt): env[cut:] = 0<br>    out[mask] = amp * np.sin(2*np.pi*freq*lt) * env<br>    return out<br><br>def build(notes, total=3.0):<br>    t = np.arange(int(total * SR)) / SR<br>    sig = np.zeros_like(t)<br>    for n in notes:<br>        sig += synth(n[&quot;freq&quot;], n[&quot;start&quot;], 1.5, n[&quot;amp&quot;], total)<br>    return t, sig<br><br>def full_fft(sig):<br>    n = len(sig)<br>    X = np.fft.rfft(sig * np.hanning(n))<br>    f = np.fft.rfftfreq(n, 1/SR)<br>    return f, np.abs(X)/n, np.angle(X)<br><br>def envelope(sig, smooth_ms=5):<br>    w = max(1, int(smooth_ms*1e-3*SR))<br>    return np.convolve(np.abs(sig), np.ones(w)/w, mode=&quot;same&quot;)<br><br># ══════════════════════════════════════════════════════════════════════════════<br>#   Console printers — the star of this file<br># ══════════════════════════════════════════════════════════════════════════════<br><br>def print_full_table_all_edos(base_freq, base_label, N):<br>    &quot;&quot;&quot;Full overtone/undertone table with 12/24/31/41/53/72-TET columns.&quot;&quot;&quot;<br>    EDO = EDO_LIST<br>    header_edo = &quot;  &quot;.join(f&quot;{e}-TET&quot;.rjust(12) for e in EDO)<br>    bar = &quot;═&quot; * 120<br>    print()<br>    print(bar)<br>    print(f&quot;  BASE: {base_label}  =  {base_freq:.4f} Hz     N = {N}&quot;)<br>    print(bar)<br><br>    def print_section(title, freqs, primes_flags):<br>        print()<br>        print(f&quot;  {title}&quot;)<br>        print(&quot;  &quot; + &quot;─&quot; * 118)<br>        hdr = (f&quot;  {&#39;n&#39;:&gt;3}  {&#39;freq (Hz)&#39;:&gt;12}   {header_edo}   prime&quot;)<br>        print(hdr)<br>        print(&quot;  &quot; + &quot;─&quot; * 118)<br>        for n, fv, is_p in freqs:<br>            cells = &quot;  &quot;.join(fmt_edo_cell(fv, e).rjust(12) for e in EDO)<br>            star = &quot;★&quot; if is_p else &quot; &quot;<br>            print(f&quot;  {n:&gt;3}  {fv:12.3f}   {cells}   {star}&quot;)<br><br>    ovt_rows = [(n, n*base_freq, is_prime(n)) for n in range(1, N+1)]<br>    unt_rows = [(n, base_freq/n, is_prime(n)) for n in range(1, N+1)]<br><br>    print_section(f&quot;OVERTONES  n·f   (n = 1..{N})   ★ = prime n&quot;, ovt_rows, [p for _,_,p in ovt_rows])<br>    print_section(f&quot;UNDERTONES  f/n  (n = 1..{N})   ★ = prime n&quot;, unt_rows, [p for _,_,p in unt_rows])<br><br>    # ---- prime summary ----<br>    primes = [n for n in range(1, N+1) if is_prime(n)]<br>    print()<br>    print(&quot;  &quot; + &quot;─&quot; * 118)<br>    print(f&quot;  PRIMES in n = 1..{N}  (count = {len(primes)}):&quot;)<br>    print(f&quot;    {primes}&quot;)<br><br>    # ---- per-EDO accuracy on prime overtones ----<br>    print()<br>    print(&quot;  PRIME OVERTONE ACCURACY PER EDO  (mean |¢ error| across prime n)&quot;)<br>    print(&quot;  &quot; + &quot;─&quot; * 118)<br>    hdr = f&quot;  {&#39;EDO&#39;:&gt;4}  {&#39;step size&#39;:&gt;10}  {&#39;mean |¢|&#39;:&gt;10}  {&#39;max |¢|&#39;:&gt;10}&quot;<br>    print(hdr)<br>    print(&quot;  &quot; + &quot;─&quot; * 118)<br>    for e in EDO:<br>        errs = []<br>        for n in primes:<br>            fv = n * base_freq<br>            _, dev = freq_to_edo_note(fv, e)<br>            errs.append(abs(dev))<br>        if errs:<br>            print(f&quot;  {e:&gt;4}  {1200/e:&gt;9.2f}¢  {np.mean(errs):&gt;10.2f}  {np.max(errs):&gt;10.2f}&quot;)<br><br>    print()<br>    print(bar)<br>    print()<br><br><br>def print_cents_table_all_edos(base_freq, base_label, N):<br>    &quot;&quot;&quot;Interval cents + EDO landing for each consecutive overtone.&quot;&quot;&quot;<br>    print()<br>    bar = &quot;═&quot; * 130<br>    print(bar)<br>    print(f&quot;  CENT INTERVALS + EDO LANDING  for {base_label} = {base_freq:.4f} Hz   N = {N}&quot;)<br>    print(bar)<br><br>    EDO = EDO_LIST<br>    header_edo = &quot;  &quot;.join(f&quot;{e}-TET&quot;.rjust(12) for e in EDO)<br><br>    for direction, sign in [(&quot;OVERTONES  (ascending)&quot;, +1),<br>                            (&quot;UNDERTONES  (descending, mirrored)&quot;, -1)]:<br>        print()<br>        print(f&quot;  {direction}&quot;)<br>        print(&quot;  &quot; + &quot;─&quot; * 128)<br>        print(f&quot;  {&#39;n→n+1&#39;:&gt;6} {&#39;cents&#39;:&gt;8} {&#39;ratio&#39;:&gt;8}   {header_edo}&quot;)<br>        print(&quot;  &quot; + &quot;─&quot; * 128)<br>        for n in range(1, N):<br>            if sign &gt; 0:<br>                f_low  = n * base_freq<br>                f_high = (n+1) * base_freq<br>                c = 1200 * np.log2(f_high / f_low)<br>                ratio = f&quot;{(n+1)}:{n}&quot;<br>                target = f_high<br>            else:<br>                f_low  = base_freq / (n+1)<br>                f_high = base_freq / n<br>                c = -1200 * np.log2(f_high / f_low)<br>                ratio = f&quot;{n}:{n+1}&quot;<br>                target = f_low<br>            cells = &quot;  &quot;.join(fmt_edo_cell(target, e).rjust(12) for e in EDO)<br>            print(f&quot;  {n:&gt;2}→{n+1:&lt;3} {c:+8.2f} {ratio:&gt;8}   {cells}&quot;)<br><br>    # ---- 72-TET reference grid (all 72 steps around the base) ----<br>    print()<br>    print(&quot;  &quot; + &quot;─&quot; * 128)<br>    print(f&quot;  72-TET REFERENCE  (nearest 12-TET-ish name, cents off C-1-based step)&quot;)<br>    print(f&quot;  showing 72 steps = 1 octave above the base&#39;s nearest 72-step&quot;)<br>    print(&quot;  &quot; + &quot;─&quot; * 128)<br>    base_step = int(round(72 * np.log2(base_freq / 16.3516)))<br>    for off in range(72):<br>        step = base_step + off<br>        cents = off * (1200/72)<br>        fv = base_freq * (2 ** (cents/1200))<br>        n12, c12 = freq_to_note(fv)<br>        n72, c72 = freq_to_edo_note(fv, 72)<br>        # find nearest simple ratio from base<br>        best_r, best_e = None, 1e9<br>        for q in range(1, 17):<br>            for p in range(q, 16*q):<br>                e = 1200*np.log2(p/q) - cents<br>                if abs(e) &lt; abs(best_e):<br>                    best_e, best_r = e, (p, q)<br>        rs = f&quot;{best_r[0]}:{best_r[1]}&quot; if best_r else &quot;—&quot;<br>        print(f&quot;  {off:&gt;3}  {cents:6.1f}¢  {n72:&gt;8}  &quot;<br>              f&quot;({c72:+5.1f}¢)  ratio≈{rs:&gt;6} ({best_e:+5.1f}¢)   [12TET {n12} {c12:+.1f}¢]&quot;)<br><br>    print()<br>    print(bar)<br>    print()<br><br><br>def print_edo_accuracy_summary(base_freq, base_label, N):<br>    &quot;&quot;&quot;Compact summary: which EDO best matches each prime overtone.&quot;&quot;&quot;<br>    print()<br>    bar = &quot;═&quot; * 100<br>    print(bar)<br>    print(f&quot;  BEST EDO PER PRIME OVERTONE  (base={base_label}={base_freq:.2f}Hz, n=1..{N})&quot;)<br>    print(bar)<br>    print(f&quot;  {&#39;n&#39;:&gt;3}  {&#39;freq (Hz)&#39;:&gt;12}  {&#39;ratio&#39;:&gt;8}  {&#39;target ¢&#39;:&gt;10}  &quot;<br>          f&quot;{&#39;best EDO&#39;:&gt;10}  {&#39;error ¢&#39;:&gt;9}&quot;)<br>    print(&quot;  &quot; + &quot;─&quot; * 96)<br>    for n in range(2, N+1):<br>        if not is_prime(n): continue<br>        fv = n * base_freq<br>        target_c = 1200 * np.log2(n)  # cents from base<br>        best_e, best_err = None, 1e9<br>        for e in EDO_LIST:<br>            _, dev = freq_to_edo_note(fv, e)<br>            if abs(dev) &lt; best_err:<br>                best_err, best_e = abs(dev), e<br>        print(f&quot;  {n:&gt;3}  {fv:12.3f}  {n:&gt;6}:1  {target_c:&gt;10.2f}  &quot;<br>              f&quot;{best_e:&gt;8}-TET  {best_err:&gt;9.2f}&quot;)<br>    print(bar)<br>    print()<br><br><br># ══════════════════════════════════════════════════════════════════════════════<br>#   GUI application<br># ══════════════════════════════════════════════════════════════════════════════<br><br>class App:<br>    MAX = 12<br><br>    def __init__(self):<br>        self.notes = []<br>        self.total = 3.0<br>        self.base_freq = 440.0<br>        self.base_label = &quot;A4&quot;<br>        self.N = 64<br><br>        plt.rcParams[&quot;font.family&quot;] = &quot;DejaVu Sans&quot;<br>        self.fig = plt.figure(figsize=(18, 13), facecolor=&quot;#f4f4f7&quot;)<br>        self.fig.suptitle(&quot;Multi-EDO Overtone / Undertone Explorer  (12/24/31/41/53/72-TET)&quot;,<br>                          fontsize=16, fontweight=&quot;bold&quot;, y=0.985)<br><br>        # ---- inputs ----<br>        ax_base = self.fig.add_axes([0.05, 0.945, 0.22, 0.035])<br>        self.tb_base = TextBox(ax_base, &quot;Base: &quot;, initial=&quot;A4&quot;)<br>        self.tb_base.on_submit(self._on_base_change)<br>        ax_N = self.fig.add_axes([0.34, 0.945, 0.12, 0.035])<br>        self.tb_N = TextBox(ax_N, &quot;N: &quot;, initial=&quot;32&quot;)<br>        self.tb_N.on_submit(self._on_N_change)<br><br>        # ---- waveform ----<br>        self.ax_wave = self.fig.add_axes([0.04, 0.755, 0.44, 0.15], facecolor=&quot;white&quot;)<br>        self.ax_wave.set_title(&quot;Waveform + envelope&quot;, fontsize=10, loc=&quot;left&quot;)<br>        self.ax_wave.set_xlabel(&quot;Time (s)&quot;)<br>        self.ax_wave.set_xlim(0, self.total); self.ax_wave.set_ylim(-1.5, 1.5)<br>        self.line_wave, = self.ax_wave.plot([], [], lw=0.4, color=&quot;#3b7dd8&quot;)<br>        self.line_env,  = self.ax_wave.plot([], [], lw=1.2, color=&quot;#d32f2f&quot;)<br>        self.line_envn, = self.ax_wave.plot([], [], lw=1.2, color=&quot;#d32f2f&quot;)<br><br>        # ---- info panel ----<br>        self.ax_info = self.fig.add_axes([0.51, 0.755, 0.47, 0.15], facecolor=&quot;white&quot;)<br>        self.ax_info.set_xticks([]); self.ax_info.set_yticks([])<br>        for s in self.ax_info.spines.values(): s.set_color(&quot;#cccccc&quot;)<br>        self.info_text = self.ax_info.text(<br>            0.015, 0.96, &quot;&quot;, family=&quot;monospace&quot;, fontsize=8, va=&quot;top&quot;,<br>            transform=self.ax_info.transAxes)<br><br>        # ---- FFT ----<br>        self.ax_fft = self.fig.add_axes([0.04, 0.54, 0.44, 0.18], facecolor=&quot;white&quot;)<br>        self.ax_fft.set_title(&quot;Steady FFT + overtone / undertone markers&quot;,<br>                              fontsize=10, loc=&quot;left&quot;)<br>        self.ax_fft.set_xlabel(&quot;Frequency (Hz)&quot;)<br>        self.ax_fft.set_xlim(0, 4000); self.ax_fft.set_ylim(0, 1)<br>        self.line_fft, = self.ax_fft.plot([], [], lw=1, color=&quot;#e07b3b&quot;)<br><br>        # ---- overtone table ----<br>        self.ax_ovt = self.fig.add_axes([0.51, 0.54, 0.23, 0.18], facecolor=&quot;white&quot;)<br>        self.ax_ovt.set_xticks([]); self.ax_ovt.set_yticks([])<br>        for s in self.ax_ovt.spines.values(): s.set_color(&quot;#cccccc&quot;)<br>        self.ovt_text = self.ax_ovt.text(<br>            0.02, 0.98, &quot;&quot;, family=&quot;monospace&quot;, fontsize=7.2, va=&quot;top&quot;,<br>            transform=self.ax_ovt.transAxes)<br><br>        # ---- undertone table ----<br>        self.ax_unt = self.fig.add_axes([0.76, 0.54, 0.22, 0.18], facecolor=&quot;white&quot;)<br>        self.ax_unt.set_xticks([]); self.ax_unt.set_yticks([])<br>        for s in self.ax_unt.spines.values(): s.set_color(&quot;#cccccc&quot;)<br>        self.unt_text = self.ax_unt.text(<br>            0.02, 0.98, &quot;&quot;, family=&quot;monospace&quot;, fontsize=7.2, va=&quot;top&quot;,<br>            transform=self.ax_unt.transAxes)<br><br>        # scroll offsets<br>        self.ovt_offset = 0<br>        self.unt_offset = 0<br>        for x, label, cb in [<br>            (0.51, &quot;▲ up&quot;,  lambda ev: self._scroll_ovt(-1)),<br>            (0.59, &quot;▼ dn&quot;,  lambda ev: self._scroll_ovt(+1)),<br>            (0.76, &quot;▲ up&quot;,  lambda ev: self._scroll_unt(-1)),<br>            (0.84, &quot;▼ dn&quot;,  lambda ev: self._scroll_unt(+1)),<br>        ]:<br>            ax = self.fig.add_axes([x, 0.505, 0.07, 0.025])<br>            b = Button(ax, label); b.on_clicked(cb)<br><br>        # ---- piano ----<br>        self.ax_piano = self.fig.add_axes([0.03, 0.435, 0.94, 0.065],<br>                                          facecolor=&quot;#f4f4f7&quot;)<br>        self._piano_keys = self._build_piano_keys((&quot;A&quot;,0), (&quot;C&quot;,8))<br>        self._draw_piano()<br><br>        # ---- note rows ----<br>        self.row_widgets = []<br>        for i in range(self.MAX):<br>            y = 0.385 - i*0.020<br>            self._build_row(i, y)<br><br>        # ---- buttons ----<br>        self._btn(&quot;▶ PLAY ALL&quot;,       [0.03, 0.03, 0.11, 0.05],<br>                  self._play_all, color=&quot;#2e7d32&quot;)<br>        self._btn(&quot;AUTO OVTs&quot;,        [0.15, 0.03, 0.11, 0.05],<br>                  self._autofill_overtones, color=&quot;#1565c0&quot;)<br>        self._btn(&quot;AUTO UNTs&quot;,        [0.27, 0.03, 0.11, 0.05],<br>                  self._autofill_undertones, color=&quot;#6a1b9a&quot;)<br>        self._btn(&quot;PRIMES ONLY&quot;,      [0.39, 0.03, 0.11, 0.05],<br>                  self._autofill_primes, color=&quot;#e65100&quot;)<br>        self._btn(&quot;PRINT ALL-EDO&quot;,    [0.51, 0.03, 0.13, 0.05],<br>                  self._print_all_edo, color=&quot;#00838f&quot;)<br>        self._btn(&quot;PRINT CENTS&quot;,      [0.65, 0.03, 0.11, 0.05],<br>                  self._print_cents, color=&quot;#0d47a1&quot;)<br>        self._btn(&quot;PRIME ACCURACY&quot;,   [0.77, 0.03, 0.11, 0.05],<br>                  self._print_prime_acc, color=&quot;#6a1b9a&quot;)<br>        self._btn(&quot;CLEAR&quot;,            [0.89, 0.03, 0.05, 0.05],<br>                  self._clear, color=&quot;#c62828&quot;)<br>        self._btn(&quot;WAV&quot;,              [0.95, 0.03, 0.04, 0.05],<br>                  self._save, color=&quot;#455a64&quot;)<br><br>        self.fig.canvas.mpl_connect(&quot;button_press_event&quot;, self._on_click)<br><br>        self._sync_sliders()<br>        self._refresh()<br>        self._print_all_edo(None)   # auto-print at launch<br><br>    # ---------- piano ----------<br>    def _midi(self, name, octave):<br>        return NOTE_NAMES.index(name) + (octave + 1) * 12<br><br>    def _build_piano_keys(self, start_note=(&quot;A&quot;,0), end_note=(&quot;C&quot;,8)):<br>        keys = []; white_index = 0<br>        sm = self._midi(*start_note); em = self._midi(*end_note)<br>        for octave in range(0, 9):<br>            for name in NOTE_NAMES:<br>                midi = self._midi(name, octave)<br>                if midi &lt; sm:<br>                    if name not in BLACK: white_index += 1<br>                    continue<br>                if midi &gt; em: break<br>                is_black = name in BLACK<br>                x = white_index - 1 + 0.68 if is_black else white_index<br>                if not is_black: white_index += 1<br>                keys.append({&quot;name&quot;: name, &quot;octave&quot;: octave, &quot;is_black&quot;: is_black, &quot;x&quot;: x})<br>            if self._midi(&quot;C&quot;, octave) &gt; em: break<br>        return keys<br><br>    def _draw_piano(self):<br>        self.ax_piano.cla()<br>        self.ax_piano.set_facecolor(&quot;#f4f4f7&quot;)<br>        self.ax_piano.set_xticks([]); self.ax_piano.set_yticks([])<br>        for s in self.ax_piano.spines.values(): s.set_visible(False)<br>        self._key_patches = []<br>        n_white = sum(1 for k in self._piano_keys if not k[&quot;is_black&quot;])<br>        for k in self._piano_keys:<br>            if k[&quot;is_black&quot;]: continue<br>            r = Rectangle((k[&quot;x&quot;], 0), 0.94, 0.95, facecolor=&quot;white&quot;,<br>                          edgecolor=&quot;#888888&quot;, lw=0.7, zorder=1)<br>            self.ax_piano.add_patch(r); self._key_patches.append((r, k))<br>            if k[&quot;name&quot;] == &quot;C&quot;:<br>                self.ax_piano.text(k[&quot;x&quot;]+0.47, 0.08, f&quot;C{k[&#39;octave&#39;]}&quot;,<br>                                   ha=&quot;center&quot;, va=&quot;bottom&quot;,<br>                                   fontsize=5.5, color=&quot;#333&quot;, zorder=3)<br>        for k in self._piano_keys:<br>            if not k[&quot;is_black&quot;]: continue<br>            r = Rectangle((k[&quot;x&quot;], 0.35), 0.60, 0.60, facecolor=&quot;#222222&quot;,<br>                          edgecolor=&quot;black&quot;, lw=0.4, zorder=2)<br>            self.ax_piano.add_patch(r); self._key_patches.append((r, k))<br>        self.ax_piano.set_xlim(-0.1, n_white + 0.1)<br>        self.ax_piano.set_ylim(-0.02, 1.0)<br><br>    def _on_click(self, ev):<br>        if ev.inaxes is not self.ax_piano: return<br>        for patch, k in reversed(self._key_patches):<br>            if patch.contains(ev)[0]:<br>                self._add_note(k[&quot;name&quot;], k[&quot;octave&quot;]); return<br><br>    # ---------- rows ----------<br>    def _build_row(self, i, y):<br>        ax_lbl = self.fig.add_axes([0.04, y, 0.15, 0.018]); ax_lbl.axis(&quot;off&quot;)<br>        lbl = ax_lbl.text(0, 0.5, &quot;&quot;, va=&quot;center&quot;, fontsize=8.5,<br>                          family=&quot;monospace&quot;, color=&quot;#333&quot;)<br>        ax_d = self.fig.add_axes([0.20, y+0.001, 0.30, 0.015])<br>        s_d = Slider(ax=ax_d, label=&quot;&quot;, valmin=0, valmax=1000,<br>                     valinit=0, valstep=1, color=&quot;#7aa6e0&quot;)<br>        s_d.on_changed(lambda v, idx=i: self._on_delay(idx, v))<br>        ax_a = self.fig.add_axes([0.53, y+0.001, 0.15, 0.015])<br>        s_a = Slider(ax=ax_a, label=&quot;&quot;, valmin=0, valmax=1,<br>                     valinit=0.4, color=&quot;#9ccc9c&quot;)<br>        s_a.on_changed(lambda v, idx=i: self._on_amp(idx, v))<br>        ax_p = self.fig.add_axes([0.71, y, 0.04, 0.017])<br>        b_p = Button(ax_p, &quot;▶&quot;); b_p.on_clicked(lambda ev, idx=i: self._play_one(idx))<br>        ax_r = self.fig.add_axes([0.76, y, 0.04, 0.017])<br>        b_r = Button(ax_r, &quot;✕&quot;); b_r.on_clicked(lambda ev, idx=i: self._remove(idx))<br>        self.row_widgets.append({&quot;label&quot;: lbl, &quot;delay&quot;: s_d, &quot;amp&quot;: s_a,<br>                                 &quot;play&quot;: b_p, &quot;remove&quot;: b_r})<br><br>    def _btn(self, text, rect, cb, color=&quot;#555555&quot;):<br>        ax = self.fig.add_axes(rect)<br>        b = Button(ax, text, color=color, hovercolor=&quot;#777777&quot;)<br>        b.label.set_color(&quot;white&quot;); b.label.set_fontweight(&quot;bold&quot;)<br>        b.on_clicked(cb); return b<br><br>    # ---------- inputs ----------<br>    def _on_base_change(self, text):<br>        parsed = parse_base(text)<br>        if parsed is None: return<br>        self.base_freq, self.base_label = parsed<br>        self.ovt_offset = 0; self.unt_offset = 0<br>        self._refresh()<br>        self._print_all_edo(None)<br><br>    def _on_N_change(self, text):<br>        self.N = parse_n(text, default=self.N)<br>        self.tb_N.set_val(str(self.N))<br>        self.ovt_offset = 0; self.unt_offset = 0<br>        self._refresh()<br>        self._print_all_edo(None)<br><br>    def _print_all_edo(self, _):<br>        print_full_table_all_edos(self.base_freq, self.base_label, self.N)<br><br>    def _print_cents(self, _):<br>        print_cents_table_all_edos(self.base_freq, self.base_label, self.N)<br><br>    def _print_prime_acc(self, _):<br>        print_edo_accuracy_summary(self.base_freq, self.base_label, self.N)<br><br>    def _scroll_ovt(self, direction):<br>        max_off = max(0, len(self._overtone_rows()) - 20)<br>        self.ovt_offset = max(0, min(max_off, self.ovt_offset + direction))<br>        self._refresh_tables()<br><br>    def _scroll_unt(self, direction):<br>        max_off = max(0, len(self._undertone_rows()) - 20)<br>        self.unt_offset = max(0, min(max_off, self.unt_offset + direction))<br>        self._refresh_tables()<br><br>    # ---------- model ----------<br>    def _add_note(self, name, octave):<br>        if len(self.notes) &gt;= self.MAX: return<br>        freq = note_to_freq(name, octave)<br>        delay = 0.0 if not self.notes else 50.0<br>        self.notes.append({&quot;name&quot;: f&quot;{name}{octave}&quot;, &quot;freq&quot;: freq,<br>                           &quot;delay_ms&quot;: delay, &quot;amp&quot;: 0.4, &quot;kind&quot;: &quot;piano&quot;})<br>        self._recompute_starts(); self._sync_sliders(); self._refresh()<br>        self._play_one(len(self.notes)-1)<br><br>    def _add_freq(self, freq, label, kind=&quot;overtone&quot;):<br>        if len(self.notes) &gt;= self.MAX: return<br>        delay = 0.0 if not self.notes else 50.0<br>        self.notes.append({&quot;name&quot;: label, &quot;freq&quot;: freq,<br>                           &quot;delay_ms&quot;: delay, &quot;amp&quot;: 0.35, &quot;kind&quot;: kind})<br><br>    def _autofill_overtones(self, _):<br>        self.notes.clear()<br>        f = self.base_freq<br>        for n in range(1, self.N+1):<br>            if len(self.notes) &gt;= self.MAX: break<br>            self._add_freq(n*f, f&quot;{n}·f&quot; + (&quot;ᵖ&quot; if is_prime(n) else &quot;&quot;), &quot;overtone&quot;)<br>        self._recompute_starts(); self._sync_sliders(); self._refresh()<br><br>    def _autofill_undertones(self, _):<br>        self.notes.clear()<br>        f = self.base_freq<br>        for n in range(1, self.N+1):<br>            if len(self.notes) &gt;= self.MAX: break<br>            self._add_freq(f/n, f&quot;f/{n}&quot; + (&quot;ᵖ&quot; if is_prime(n) else &quot;&quot;), &quot;undertone&quot;)<br>        self._recompute_starts(); self._sync_sliders(); self._refresh()<br><br>    def _autofill_primes(self, _):<br>        self.notes.clear()<br>        f = self.base_freq<br>        primes = [n for n in range(2, self.N+1) if is_prime(n)]<br>        for n in primes:<br>            if len(self.notes) &gt;= self.MAX//2: break<br>            self._add_freq(n*f, f&quot;{n}·fᵖ&quot;, &quot;overtone&quot;)<br>        for n in primes:<br>            if len(self.notes) &gt;= self.MAX: break<br>            self._add_freq(f/n, f&quot;f/{n}ᵖ&quot;, &quot;undertone&quot;)<br>        self._recompute_starts(); self._sync_sliders(); self._refresh()<br><br>    def _on_delay(self, i, v):<br>        if i &gt;= len(self.notes): return<br>        self.notes[i][&quot;delay_ms&quot;] = float(v)<br>        self._recompute_starts(); self._refresh()<br><br>    def _on_amp(self, i, v):<br>        if i &gt;= len(self.notes): return<br>        self.notes[i][&quot;amp&quot;] = float(v); self._refresh()<br><br>    def _remove(self, i):<br>        if i &lt; len(self.notes):<br>            self.notes.pop(i)<br>            self._recompute_starts(); self._sync_sliders(); self._refresh()<br><br>    def _clear(self, _):<br>        self.notes.clear(); self._sync_sliders(); self._refresh()<br><br>    def _recompute_starts(self):<br>        acc = 0.0<br>        for n in self.notes:<br>            acc += n[&quot;delay_ms&quot;]/1000.0<br>            n[&quot;start&quot;] = acc<br><br>    def _sync_sliders(self):<br>        for i, w in enumerate(self.row_widgets):<br>            if i &lt; len(self.notes):<br>                n = self.notes[i]<br>                w[&quot;delay&quot;].set_val(n[&quot;delay_ms&quot;])<br>                w[&quot;amp&quot;].set_val(n[&quot;amp&quot;])<br>                w[&quot;label&quot;].set_text(f&quot;{n[&#39;name&#39;]:&lt;9} {n[&#39;freq&#39;]:7.1f}Hz&quot;)<br>            else:<br>                w[&quot;delay&quot;].set_val(0); w[&quot;amp&quot;].set_val(0.4)<br>                w[&quot;label&quot;].set_text(&quot;&quot;)<br><br>    # ---------- audio ----------<br>    def _play_one(self, i):<br>        if i &gt;= len(self.notes) or not HAVE_AUDIO: return<br>        n = self.notes[i]; dur = 0.6<br>        t = np.arange(int(dur*SR))/SR<br>        env = np.ones_like(t); a, r = int(0.005*SR), int(0.03*SR)<br>        env[:a] = np.linspace(0,1,a); env[-r:] *= np.linspace(1,0,r)<br>        wav = n[&quot;amp&quot;]*np.sin(2*np.pi*n[&quot;freq&quot;]*t)*env<br>        try: sd.play(wav, SR)<br>        except Exception: pass<br><br>    def _play_all(self, _):<br>        if not self.notes: return<br>        _, sig = build(self.notes, self.total)<br>        p = np.max(np.abs(sig))<br>        if p &gt; 0: sig = sig / p * 0.9<br>        if HAVE_AUDIO:<br>            try: sd.play(sig, SR)<br>            except Exception: pass<br><br>    def _save(self, _):<br>        if not self.notes: return<br>        _, sig = build(self.notes, self.total)<br>        p = np.max(np.abs(sig)) or 1.0<br>        wavfile.write(&quot;cascade.wav&quot;, SR, np.int16(sig/p*32767))<br>        print(&quot;Saved cascade.wav&quot;)<br><br>    # ---------- in-GUI tables (compact) ----------<br>    def _overtone_rows(self):<br>        return [(n, n*self.base_freq, is_prime(n)) for n in range(1, self.N+1)]<br><br>    def _undertone_rows(self):<br>        return [(n, self.base_freq/n, is_prime(n)) for n in range(1, self.N+1)]<br><br>    def _refresh_tables(self):<br>        ovt = self._overtone_rows(); unt = self._undertone_rows()<br><br>        lines = [f&quot;{&#39;n&#39;:&gt;3} {&#39;freq&#39;:&gt;10} {&#39;12&#39;:&gt;5} {&#39;24&#39;:&gt;5}  p&quot;]<br>        lines.append(&quot;─&quot; * 28)<br>        for n, fv, p in ovt[self.ovt_offset:self.ovt_offset+20]:<br>            n12, _ = freq_to_note(fv)<br>            n24, _ = freq_to_edo_note(fv, 24)<br>            star = &quot;★&quot; if p else &quot; &quot;<br>            lines.append(f&quot;{n:&gt;3} {fv:10.2f} {n12:&gt;5} {n24:&gt;5}  {star}&quot;)<br>        total_p = sum(1 for _,_,p in ovt if p)<br>        lines.append(&quot;&quot;)<br>        lines.append(f&quot;{self.ovt_offset+1}–{min(self.ovt_offset+20,len(ovt))} of {len(ovt)}&quot;)<br>        lines.append(f&quot;{total_p} primes in n=1..{self.N}&quot;)<br>        self.ovt_text.set_text(&quot;\n&quot;.join(lines))<br><br>        lines = [f&quot;{&#39;n&#39;:&gt;3} {&#39;freq&#39;:&gt;10} {&#39;12&#39;:&gt;5} {&#39;24&#39;:&gt;5}  p&quot;]<br>        lines.append(&quot;─&quot; * 28)<br>        for n, fv, p in unt[self.unt_offset:self.unt_offset+20]:<br>            n12, _ = freq_to_note(fv)<br>            n24, _ = freq_to_edo_note(fv, 24)<br>            star = &quot;★&quot; if p else &quot; &quot;<br>            lines.append(f&quot;{n:&gt;3} {fv:10.2f} {n12:&gt;5} {n24:&gt;5}  {star}&quot;)<br>        total_p = sum(1 for _,_,p in unt if p)<br>        lines.append(&quot;&quot;)<br>        lines.append(f&quot;{self.unt_offset+1}–{min(self.unt_offset+20,len(unt))} of {len(unt)}&quot;)<br>        lines.append(f&quot;{total_p} primes in n=1..{self.N}&quot;)<br>        self.unt_text.set_text(&quot;\n&quot;.join(lines))<br><br>    # ---------- refresh ----------<br>    def _refresh(self):<br>        t, sig = build(self.notes, self.total)<br>        self.line_wave.set_data(t, sig)<br>        env = envelope(sig, 5)<br>        self.line_env.set_data(t, env); self.line_envn.set_data(t, -env)<br>        ymax = max(np.max(np.abs(sig))*1.15, 0.05)<br>        self.ax_wave.set_ylim(-ymax, ymax)<br><br>        f, m, phases = full_fft(sig)<br>        self.line_fft.set_data(f, m)<br>        mmax = m.max() if m.max() &gt; 0 else 1.0<br>        self.ax_fft.set_ylim(0, mmax*1.15)<br><br>        for ln in list(self.ax_fft.lines):<br>            if ln is not self.line_fft: ln.remove()<br>        for txt in list(self.ax_fft.texts): txt.remove()<br><br>        for n, fv, p in self._overtone_rows():<br>            if fv &gt; 4000: break<br>            col = &quot;#ff7f0e&quot; if p else &quot;#7aa6e0&quot;<br>            self.ax_fft.axvline(fv, color=col, alpha=0.55, ls=&quot;-&quot;,<br>                                lw=1.0 if p else 0.4)<br>            if p and n &lt; 20:<br>                self.ax_fft.text(fv, 1.02, str(n), ha=&quot;center&quot;, fontsize=6.5,<br>                                 color=col, transform=self.ax_fft.get_xaxis_transform())<br>        for n, fv, p in self._undertone_rows():<br>            if fv &gt; 4000: continue<br>            if fv &lt; 5: break<br>            col = &quot;#9b59b6&quot; if p else &quot;#c9b6e4&quot;<br>            self.ax_fft.axvline(fv, color=col, alpha=0.5, ls=&quot;--&quot;,<br>                                lw=1.0 if p else 0.4)<br><br>        self._update_info()<br>        self._refresh_tables()<br>        self.fig.canvas.draw_idle()<br><br>    def _update_info(self):<br>        base = self.base_freq<br>        bnote, bcents = freq_to_note(base)<br>        ovt_primes = [n for n,_,p in self._overtone_rows() if p]<br>        lines = [f&quot;BASE: {self.base_label}  →  {base:.3f} Hz  &quot;<br>                 f&quot;({bnote} {bcents:+.1f}¢)     N = {self.N}&quot;, &quot;&quot;]<br>        lines.append(&quot;EDO accuracy on prime overtones (mean |¢|):&quot;)<br>        lines.append(&quot;─&quot; * 55)<br>        for e in EDO_LIST:<br>            errs = []<br>            for n in ovt_primes:<br>                _, dev = freq_to_edo_note(n*base, e)<br>                errs.append(abs(dev))<br>            if errs:<br>                lines.append(f&quot;  {e:&gt;3}-TET  step {1200/e:5.2f}¢  &quot;<br>                             f&quot;mean err {np.mean(errs):5.2f}¢  max {np.max(errs):5.2f}¢&quot;)<br>        lines.append(&quot;&quot;)<br>        lines.append(f&quot;primes in 1..{self.N}: {ovt_primes}&quot;)<br>        lines.append(&quot;&quot;)<br>        lines.append(&quot;CURRENT NOTES&quot;)<br>        lines.append(&quot;─&quot; * 55)<br>        if not self.notes:<br>            lines.append(&quot;  (empty — click piano or AUTO)&quot;)<br>        else:<br>            for i, nt in enumerate(self.notes, 1):<br>                lines.append(f&quot;  {i:&gt;2}. {nt[&#39;name&#39;]:&lt;9} {nt[&#39;freq&#39;]:8.2f}Hz  &quot;<br>                             f&quot;onset {nt[&#39;start&#39;]*1000:4.0f}ms  Δ {nt[&#39;delay_ms&#39;]:4.0f}ms&quot;)<br>        self.info_text.set_text(&quot;\n&quot;.join(lines))<br><br><br>if __name__ == &quot;__main__&quot;:<br>    App()<br>    plt.show()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5005b406c5ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Los Módulos y Números Primos]]></title>
            <link>https://medium.com/@sumit.tripathi/los-m%C3%B3dulos-y-n%C3%BAmeros-primos-f05984865045?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f05984865045</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Fri, 13 Nov 2026 08:31:03 GMT</pubDate>
            <atom:updated>2026-11-15T00:57:43.431Z</atom:updated>
            <content:encoded><![CDATA[<h4>Una observación sobre los patrones de números primos</h4><p>Cuando aprendí sobre números primos, hemos aprendido que la mayoría de los números son números impares. Entonces cada número primo puede seguir 2x+/-1. Después he encontrado que podemos usar la forma de 6x+/-1 también. Esto significa que muchos números primos</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4P20ISe35UjMD2S9H9mzg.png" /><figcaption>N=10,000</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-VHpHEMcNOHDEiAeCTj-A.png" /><figcaption>N=20,000</figcaption></figure><p>Es muy interesante que 4x+/-1 es un poco mejor que 6x+/-1 en este ejemplo! (porque puede contar 3). Me parece esta serie de 2,3,4,6,8,5,12, etc. es muy especial y me recuerde una serie de un tema de química (de los electrones me parece).</p><p>En lugar de +/-1 podemos usar el M/2 +/-1 también. Es porque la simetría de + y -. Entonces por M =4 el residual 1 se igual 3 o -1. Sólo se aplicaba si M es un número impar. Si no, necesitamos +/-1 el resulto una vez más.(?)</p><p>Un intento de abordar la conjetura de Goldbach</p><p>Porque podemos escribir todos los números primos en la forma de 4x+/-1. Si pudieramos añadir dos números primos , tendrémos 4 patrones principales como :</p><ol><li>4m+1 + 4n+1 = 4m + 4n + 2 (esto es por supuesto un número par y tiene 4m+4n+2 mod 4 = 2)</li><li>4m-1 + 4n+1 = 4m + 4n (esto es también un número par y tiene 4m+4n mod 4 = 0)</li><li>4m+1 + 4n-1 = 4m + 4n (esto es también un número par y tiene 4m+4n mod 4 = 0)</li><li>4m-1 + 4n-1 = 4m + 4n -2 (esto es por supuesto un número par y tiene 4m+4n+2 mod 4 = -2)</li></ol><p>(por cada m,n diferentes) — entonces por cualquier m y n podemos escribir cualquier números ??????? Al menos todos los números pares lo podemos abordar???? no estoy seguro, esto no es tan suficiente aún.</p><p>Comentario 14–15/11/26 — Si podemos analizar más las relaciones de m y n podríamos entender mejor.</p><ol><li>4m+1 + 4n+1 == (ej. 13 + 17 = 30; 5 + 29 = 34; 37 + 47 = 84; etc. — siempre tiene 0, 2, 4, 6, 8 por último dígito) — (m,n) = (1,1), (1,3), (1,4), (1, 5), etc.</li><li>4m-1 + 4n+1 == (ej. 7 + 17 = 24; 31 + 29 = 60; etc.) — (m,n) = (1,1), (1,3), (1,4), (1,7), etc.</li><li>4m+1 + 4n-1 == (ej. 5 + 83 = 88; 5 + 43 = 48; etc.) — (m,n) = (1,1), (1,2), (1,3), (1,5), etc.</li><li>4m-1 + 4n-1 == (ej. 3 + 11 = 14; 23 + 83 = 106; etc.) — (m,n)=(1,1), (1,2), (1,3), (1,5), etc.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vaWaBhITpWkyAKBoNAb1tQ.png" /></figure><p>Por los números pares,</p><p>??????</p><p>La otra observación es que por cada módulo que es un número primo. La distribución de los residuales serán muy semejante. Por ejemplo M = 2,3,5,7,11, etc., la distribución es muy equilibrio por cada residual.</p><p>Entonces podemos usar esta observación para crear un nuevo método para buscar números primos nuevos.</p><p>Comentario: Porque los módulos +/-1 existe en todos los casos, entonces los productos de los números primos — 1 = un número primo? (productos de módulos = 1 es 1)…</p><pre>2–1 = 1 ?? esto es una excepción, pero me siento que hay algo más profundo sobre 1 que no he entendido aún.<br>2*3-1 = 5 //<br>2*3*5-1 = 29 //<br>2*3*5*7-1 = 209 X<br>2*3*5*7*11-1 = 2309 // <br>2*3*5*7*11*13-1 = 30029 //<br>2*3*5*7*11*13*17-1 = 510509 x<br>2*3*5*7*11*13*17*19-1 = 9699689 x<br>2*3*5*7*11*13*17*19*23-1 = 223092869 X<br>2*3*5*7*11*13*17*19*23*29-1 = 6469693229 X<br>2*3*5*7*11*13*17*19*23*29*31-1 = 200560490129 X<br>2*3*5*7*11*13*17*19*23*29*31*37-1 = 7420738134809 X<br>...<br><br></pre><p>NO es el caso,</p><p>pero si cambiamos el -1 por “otras valores” podrámos obtener los números prmos?.. WIP</p><p>Si sólo vemos 2^n, los residuales serán +/-1 entonces tenemos los números primos de Mersenne 2^n (+/)-1</p><p>Es podemos ver 3^n, los residuales serán +/-1 o +/-2, entonces 3^n +/- 2 podría darnos unos números primos. — Mersenne(3)</p><p>O se veíamos 11, el residual es 9. Entonces 11^2n-9 podría tener el número primo.??</p><p>etc.</p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br>from sympy import sieve<br><br><br>def build_primes(N):<br>    &quot;&quot;&quot;All primes ≤ N.&quot;&quot;&quot;<br>    sieve.extend(N)<br>    return np.array(list(sieve.primerange(2, N + 1)), dtype=np.int64)<br><br><br>def rank_residues_for_modulus(M, primes):<br>    &quot;&quot;&quot;Return [(r, prime_count), ...] sorted descending for modulus M.&quot;&quot;&quot;<br>    counts = np.bincount(primes % M, minlength=M)<br>    ranking = [(int(r), int(counts[r])) for r in range(M)]<br>    ranking.sort(key=lambda t: t[1], reverse=True)<br>    return ranking<br><br><br>def rank_all_moduli(N, primes):<br>    &quot;&quot;&quot;For every M in [2, N-1], rank residues and record the best.&quot;&quot;&quot;<br>    per_modulus = {}<br>    for M in range(2, N):<br>        ranking = rank_residues_for_modulus(M, primes)<br>        best_r, best_count = ranking[0]<br>        per_modulus[M] = {<br>            &quot;M&quot;: M,<br>            &quot;residue_ranking&quot;: ranking,<br>            &quot;best_residue&quot;: best_r,<br>            &quot;best_count&quot;: best_count,<br>        }<br>    ordered = sorted(per_modulus.values(),<br>                     key=lambda x: x[&quot;best_count&quot;], reverse=True)<br>    return ordered<br><br><br>def print_report(ordered, N, primes, top_moduli=10, top_residues=5):<br>    pi_N = len(primes)<br>    print(f&quot;\nN = {N}   →   π(N) = {pi_N} primes in [2, {N}]\n&quot;)<br><br>    print(&quot;=&quot; * 78)<br>    print(&quot;RANK 1: Moduli M &lt; N ranked by their BEST residue&#39;s prime count&quot;)<br>    print(&quot;=&quot; * 78)<br>    header = f&quot;{&#39;rank&#39;:&gt;4} {&#39;M&#39;:&gt;6} {&#39;best r&#39;:&gt;7} {&#39;primes hit&#39;:&gt;11} {&#39;% of π(N)&#39;:&gt;10}&quot;<br>    print(header)<br>    print(&quot;-&quot; * len(header))<br>    for i, m in enumerate(ordered[:top_moduli], 1):<br>        pct = m[&quot;best_count&quot;] / pi_N * 100<br>        print(f&quot;{i:&gt;4} {m[&#39;M&#39;]:&gt;6} {m[&#39;best_residue&#39;]:&gt;7} &quot;<br>              f&quot;{m[&#39;best_count&#39;]:&gt;11} {pct:&gt;9.2f}%&quot;)<br><br>    print(&quot;\n&quot; + &quot;=&quot; * 78)<br>    print(f&quot;RANK 2: Top {top_residues} residues per modulus &quot;<br>          f&quot;(for the top {top_moduli} moduli)&quot;)<br>    print(&quot;=&quot; * 78)<br>    for i, m in enumerate(ordered[:top_moduli], 1):<br>        print(f&quot;\n--- M = {m[&#39;M&#39;]}  (best: r={m[&#39;best_residue&#39;]}, &quot;<br>              f&quot;hits {m[&#39;best_count&#39;]} primes) ---&quot;)<br>        for r, cnt in m[&quot;residue_ranking&quot;][:top_residues]:<br>            pct = cnt / pi_N * 100<br>            print(f&quot;    r={r:&gt;4}   primes hit = {cnt:&gt;5}   ({pct:&gt;5.2f}% of π(N))&quot;)<br><br><br>def plot(ordered, N, primes, top_moduli=10, top_residues=5):<br>    pi_N = len(primes)<br>    top = ordered[:top_moduli]<br><br>    fig = plt.figure(figsize=(16, 12))<br>    gs = fig.add_gridspec(2, 1, height_ratios=[1.0, 1.4], hspace=0.55)<br><br>    # ---- Top panel: rank moduli by best residue&#39;s prime count ----<br>    ax1 = fig.add_subplot(gs[0])<br>    Ms = [m[&quot;M&quot;] for m in top]<br>    counts = [m[&quot;best_count&quot;] for m in top]<br>    xlabels = [f&quot;M={m[&#39;M&#39;]}\nbest r={m[&#39;best_residue&#39;]}&quot; for m in top]<br><br>    palette = plt.cm.tab10(np.linspace(0, 1, len(Ms)))<br>    ax1.bar(range(len(Ms)), counts, color=palette,<br>            edgecolor=&quot;black&quot;, linewidth=0.4)<br>    ax1.set_xticks(range(len(Ms)))<br>    ax1.set_xticklabels(xlabels, fontsize=9)<br><br>    for i, c in enumerate(counts):<br>        ax1.text(i, c + max(counts) * 0.01, str(c),<br>                 ha=&quot;center&quot;, va=&quot;bottom&quot;, fontsize=9, fontweight=&quot;bold&quot;)<br><br>    ax1.set_ylabel(f&quot;Primes ≤ {N} hit by best residue&quot;)<br>    ax1.set_title(<br>        f&quot;Rank 1 — Top {top_moduli} moduli M &lt; N, ranked by best-residue prime count\n&quot;<br>        f&quot;N = {N},  π(N) = {pi_N}&quot;,<br>        fontsize=12,<br>    )<br>    ax1.grid(axis=&quot;y&quot;, alpha=0.3)<br>    ax1.set_ylim(0, max(counts) * 1.15)<br><br>    # ---- Bottom panel: per-modulus top residues, labeled by actual r ----<br>    ax2 = fig.add_subplot(gs[1])<br><br>    # Build one group per modulus, each with its top_residues residues<br>    n_mod = len(top)<br>    n_res = top_residues<br>    # x positions: for modulus j, residues sit at j*stride + k<br>    stride = n_res + 1                     # gap between modulus groups<br>    group_centers = []<br><br>    for j, m in enumerate(top):<br>        base = j * stride<br>        residues = [r for r, _ in m[&quot;residue_ranking&quot;][:n_res]]<br>        counts_j = [c for _, c in m[&quot;residue_ranking&quot;][:n_res]]<br>        xs = [base + k for k in range(len(residues))]<br><br>        color = palette[j]<br>        ax2.bar(xs, counts_j, color=color, edgecolor=&quot;black&quot;,<br>                linewidth=0.4, label=f&quot;M={m[&#39;M&#39;]}&quot;)<br><br>        # label the residue value under each bar<br>        for x, r, c in zip(xs, residues, counts_j):<br>            ax2.text(x, c + max(counts) * 0.01, str(c),<br>                     ha=&quot;center&quot;, va=&quot;bottom&quot;, fontsize=7)<br>            ax2.text(x, -max(counts) * 0.05, f&quot;r={r}&quot;,<br>                     ha=&quot;center&quot;, va=&quot;top&quot;, fontsize=7, rotation=0)<br><br>        group_centers.append(base + (len(residues) - 1) / 2)<br><br>    # x ticks = modulus centers; everything else is labeled per bar<br>    ax2.set_xticks(group_centers)<br>    ax2.set_xticklabels([f&quot;M = {m[&#39;M&#39;]}&quot; for m in top], fontsize=10,<br>                        fontweight=&quot;bold&quot;)<br>    ax2.tick_params(axis=&quot;x&quot;, pad=28)       # room for residue labels below<br><br>    ax2.set_ylabel(f&quot;Primes ≤ {N} hit&quot;)<br>    ax2.set_title(<br>        f&quot;Rank 2 — Top {top_residues} residues for each of the top {top_moduli} moduli\n&quot;<br>        f&quot;(bar labels show prime count above, residue value below)&quot;,<br>        fontsize=12,<br>    )<br>    ax2.legend(fontsize=8, ncol=n_mod, loc=&quot;upper right&quot;)<br>    ax2.grid(axis=&quot;y&quot;, alpha=0.3)<br>    ax2.set_ylim(-max(counts) * 0.12, max(counts) * 1.18)<br><br>    # separators between modulus groups<br>    for j in range(1, n_mod):<br>        ax2.axvline(j * stride - 1.0, color=&quot;gray&quot;, linestyle=&quot;:&quot;,<br>                    linewidth=0.8, alpha=0.6)<br>    plt.show()<br><br><br>if __name__ == &quot;__main__&quot;:<br>    N = 10_000<br>    TOP_MODULI = 10<br>    TOP_RESIDUES = 5<br><br>    primes = build_primes(N)<br>    ordered = rank_all_moduli(N, primes)<br><br>    print_report(ordered, N, primes,<br>                 top_moduli=TOP_MODULI, top_residues=TOP_RESIDUES)<br>    plot(ordered, N, primes,<br>         top_moduli=TOP_MODULI, top_residues=TOP_RESIDUES)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f05984865045" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Teoría de Juegos Diferencial]]></title>
            <link>https://medium.com/@sumit.tripathi/teor%C3%ADa-de-juegos-diferencial-78b26b30e0a1?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/78b26b30e0a1</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 12:04:50 GMT</pubDate>
            <atom:updated>2026-11-07T00:49:28.393Z</atom:updated>
            <content:encoded><![CDATA[<h4>Usando la diferencial para calcular la estrategia y dibujar los dibujos de cuestas y opciones</h4><p>Hoy cuando enseño la teoría de juegos a los estudiantes, a veces me confundí como podemos explicar mejor Nash equilibrium. Cuando he tratado, tuve una idea para mapear la tabla y la estrategia usando la diferencia entre los valores de cada opción.</p><p>Mira, el equilibrio Nash es la estrategia que cada persona quiere ganar, pero el resulto no es tan bueno. Si cada persona quiere cambia su opción, tal vez el resulto no mejora también para cada persona. SÓLO cuando cambien juntos las opciones, podrían dejar de este equilibrio Nash. Este problema es muy parecido con min vs. max, o los pendientes de las líneas en cálculo, o coste de oportunidad, etc. En mi mente, creo que podemos dibujar esto no sólo en la forma tabla, quizás tendremos un nuevo modelo para explicar otras formas afuera de oligopolio también.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*g9O15sb9hEmDKJgpIAXBjg.png" /></figure><p>Un ejemplo de un dibujo de ‘Payoff matrix’ con la diferencia si cada persona cambia su opción. Podemos calcular el ‘equilibrio Nash’ usando el punto o opción con pendientes largas en general (?) porque los pendientes significan el ‘tradeoff’ o costa de oportunidad (como en el dibujo de PPC). Entonces, usando esta manera podemos buscar las estrategias varias.</p><p>Además, usando este método, la hipótesis que tengo yo es que podemos revisar el model de oferta de demanda, pero no estoy seguro cómo lo podemos aún.</p><p>El otro problema es cómo podemos visualizar usando este modelo cuando tenemos más de 2 jugadores? La tabla sea muy eficiente, pero también necesito ver los dinámicos entre opciones. Talvez podemos calcular sólo la diferencias de todas las personas en el dibujo? etc.</p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br>from itertools import product<br><br># ----------------------------------------------------------------------<br># 1. Define the payoff matrix<br>#    rows = Row player&#39;s strategies, cols = Column player&#39;s strategies<br>#    Each cell is (payoff_to_Row, payoff_to_Column)<br># ----------------------------------------------------------------------<br>row_strats = [&quot;C&quot;, &quot;D&quot;]<br>col_strats = [&quot;C&quot;, &quot;D&quot;]<br><br># Example: asymmetric Prisoner&#39;s Dilemma<br>payoffs = {<br>    (&quot;C&quot;, &quot;C&quot;): (3, 3),<br>    (&quot;C&quot;, &quot;D&quot;): (0, 5),<br>    (&quot;D&quot;, &quot;C&quot;): (5, 0),<br>    (&quot;D&quot;, &quot;D&quot;): (1, 1),<br>}<br><br>cells = list(product(row_strats, col_strats))  # all grid cells<br><br># ----------------------------------------------------------------------<br># 2. Differential tables: gain/loss for each player when moving<br>#    from a starting cell to another cell (only Row changes, Col changes,<br>#    or both change). We report the change in *that player&#39;s own* payoff.<br># ----------------------------------------------------------------------<br>def differential_table(player_index, player_name):<br>    print(f&quot;\n=== Differential table for {player_name} &quot;<br>          f&quot;(change in own payoff) ===&quot;)<br>    header = f&quot;{&#39;from -&gt; to&#39;:&lt;18}&quot; + &quot;&quot;.join(f&quot;{str(c):&gt;12}&quot; for c in cells)<br>    print(header)<br>    table = {}<br>    for start in cells:<br>        row_label = f&quot;{start}&quot;<br>        line = f&quot;{row_label:&lt;18}&quot;<br>        for end in cells:<br>            delta = payoffs[end][player_index] - payoffs[start][player_index]<br>            table[(start, end)] = delta<br>            sign = &quot;+&quot; if delta &gt;= 0 else &quot;&quot;<br>            line += f&quot;{sign + str(delta):&gt;12}&quot;<br>        print(line)<br>    return table<br><br>row_diff = differential_table(0, &quot;Row&quot;)<br>col_diff = differential_table(1, &quot;Column&quot;)<br><br># ----------------------------------------------------------------------<br># 3. Line-graph visualisation<br>#    x-axis = Row player&#39;s payoff, y-axis = Column player&#39;s payoff.<br>#    We plot the trajectory of (Row payoff, Col payoff) as we walk<br>#    through the cells, and mark gains/losses with arrows/labels.<br># ----------------------------------------------------------------------<br>row_payoffs = [payoffs[c][0] for c in cells]<br>col_payoffs = [payoffs[c][1] for c in cells]<br><br>fig, ax = plt.subplots(figsize=(8, 6))<br><br># Draw the payoff points<br>ax.plot(row_payoffs, col_payoffs, &quot;o-&quot;, color=&quot;steelblue&quot;,<br>        linewidth=2, markersize=9, zorder=3, label=&quot;path through cells&quot;)<br><br># Annotate each point with its cell label<br>for c, x, y in zip(cells, row_payoffs, col_payoffs):<br>    ax.annotate(f&quot;{c}\n({x},{y})&quot;, (x, y),<br>                textcoords=&quot;offset points&quot;, xytext=(8, 8),<br>                fontsize=9)<br><br># Draw arrows for every move, coloured by Row&#39;s gain/loss<br># (blue = Row gains, red = Row loses, grey = no change)<br>for start in cells:<br>    for end in cells:<br>        if start == end:<br>            continue<br>        x0, y0 = payoffs[start]<br>        x1, y1 = payoffs[end]<br>        d = row_diff[(start, end)]<br>        color = &quot;green&quot; if d &gt; 0 else (&quot;red&quot; if d &lt; 0 else &quot;grey&quot;)<br>        ax.annotate(&quot;&quot;, xy=(x1, y1), xytext=(x0, y0),<br>                    arrowprops=dict(arrowstyle=&quot;-&gt;&quot;, color=color,<br>                                    alpha=0.35, lw=1.2))<br><br>ax.set_xlabel(&quot;Row player&#39;s payoff&quot;)<br>ax.set_ylabel(&quot;Column player&#39;s payoff&quot;)<br>ax.set_title(&quot;Payoff space: cells as points, moves as arrows\n&quot;<br>             &quot;(green = Row gains, red = Row loses, grey = no change)&quot;)<br>ax.grid(True, alpha=0.3)<br>ax.legend()<br>plt.tight_layout()<br>plt.savefig(&quot;payoff_space.png&quot;, dpi=150)<br>plt.show()<br><br># ----------------------------------------------------------------------<br># 4. Optional: bar chart of gains/losses per move (easy to read)<br># ----------------------------------------------------------------------<br>move_labels = [f&quot;{s}-&gt;{e}&quot; for s in cells for e in cells if s != e]<br>row_gains = [row_diff[(s, e)] for s in cells for e in cells if s != e]<br>col_gains = [col_diff[(s, e)] for s in cells for e in cells if s != e]<br><br>x = np.arange(len(move_labels))<br>width = 0.4<br><br>fig2, ax2 = plt.subplots(figsize=(14, 5))<br>ax2.bar(x - width/2, row_gains, width, label=&quot;Row gain/loss&quot;,<br>        color=&quot;steelblue&quot;)<br>ax2.bar(x + width/2, col_gains, width, label=&quot;Column gain/loss&quot;,<br>        color=&quot;darkorange&quot;)<br>ax2.axhline(0, color=&quot;black&quot;, lw=0.8)<br>ax2.set_xticks(x)<br>ax2.set_xticklabels(move_labels, rotation=90, fontsize=8)<br>ax2.set_ylabel(&quot;Change in own payoff&quot;)<br>ax2.set_title(&quot;Gain/loss for each player per move&quot;)<br>ax2.legend()<br>plt.tight_layout()<br>plt.savefig(&quot;gain_loss_bars.png&quot;, dpi=150)<br>plt.show()</pre><blockquote>7/11/26 — Comentario: Porque podemos dibujar la diferencial del payoff matrix, podríamos calcular dy/dx o dx/dy o las líneas marginales también, etc.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78b26b30e0a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Social Capital Market]]></title>
            <link>https://medium.com/@sumit.tripathi/social-capital-market-064f3c348657?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/064f3c348657</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Wed, 21 Oct 2026 14:06:32 GMT</pubDate>
            <atom:updated>2026-11-24T03:40:28.742Z</atom:updated>
            <content:encoded><![CDATA[<h4>Expanding the circular flow diagrams to cover multiple aspects of our societies</h4><p>In my macroeconomics classe, I often use the circular flow diagram to explain major concepts like inflations and how policies work in general. And in some way it grounds me to the reality of things in the market rather than being stuck in a some imaginary theory in the air.</p><p>That’s why I feel that this has the potential to be expanded and augmented further. For example, I imagine it to look like a map with ‘’third space’ or communities in between not just the regular diagram with household and firms to better reflect our societies. Perhaps it might even be expanded to something akin to a map with major activities that can be distilled into this diagram (or perhaps something like SIM CITY 3000 haha).</p><p>The key point here that led me to study this further is that, I still see the gap between what policymakers do and what the societies really need. It could be structural or not I do not know, but I really think that we can find more levers to better help the economy than what we are doing right now. And by economy here I do not mean just the economic activities but something deeper than just making money. It’s about our activities that bring people together to help each of us explore ourselves better and better yet be liberated from this samsara (haha this last part is too philosophical). Anyway, back to the topic, this is where I think we really have to rethink the way our economy functions. And I want to maximise the use of the circular flow diagram to try and explore this.</p><h4>Social Capital</h4><p>There are lots of definitions for social capital out there. In my case, this social capital refers to <em>the resources that a being can use to give or transact with others in the society. </em>And this is not just about money. When I was young I was so enamoured by the world of Ragnarok Online and and how they built such lasting communities across generations. Something that later play-to-win games could not really replicate fully yet (in my opinion). And this to me is because there are other layers of markets that run in parallel that creates a tapestry of social interactions. Imagine going into a place or event with cool people showing their cool inventions or skills. The feeling that sometimes money is needed but something else is also important? This is the kind of society or community I aspire to be in. And sometimes having money is cool and it should be. I don’t want to say that we do not need money at all. But I would like to emphasise that once you have that, what other things are also out there.</p><p>Having a multi-layer market that’s not just all about money can help create a balance in a way that we might not know. One of my favourite formula in the microecon and macroecon class is the HHI or Herfindahl-Hirschmann Index which helps us understand whether the market is concentrated or decentralised. I like it because it helps us understand whether some entities are overindexed or underindexed or not. In the same way I relate this back to the elasticities concept where the lesser options you have the more inelastic it would be. If our societies are too obsessed with money, they risk becoming too inelastic. We need many options to diversify us from being a captive audience to the market that sometimes can be too cruel. This multi-layer market or multi-facet market can also help create new levers for policymakers as well help dissipate the major issues like inflations across the layers as well.</p><p>The other reason for having a multi-facet economy is our obsession with metrics. Recently I got to learn about the Goodhart’s law and how being overly focused on the goal may create unintended effect or deviate us rom the main focus that got us to think about that metric in the first place. Having a multi-facet with multiple levers will help create and balance the market better since we have many levers and to look at. Perhaps because of the multi-facet social capital/currency, we might be able to leverage different social capitals that could be stacked across layers like stacking coupons to create new combos and beyond, etc. (just an example).</p><p>Lastly, one of the reasons, I want to explore this is that I believe that evolutionary principles guide us and that there are multiple balancing levers given the limited resources or slower-changing resources (compared to our needs). As such the current focus on accumulating might not be truly sustainable in the long run. And where else can see these kinds of scenarios take place than in our lives especially in jobs where we one day find ourselves not willing to take higher salary for some other opportunities or activities or even for family and relations that we want to focus on.</p><h4>Looking for different facets of the markets</h4><p>Now, to understand the different facets of the markets we can continue to use the example when we work in a job and look for things that we need from others. Or we can also look for things that we need from other people in general as well:</p><p>Here are some thought I jotted down:</p><ul><li>Safety from others / Peace / hide / from enemy</li><li>Recognition from others /dignity — Express oneself to the community / show off one’s resources or achievement</li><li>Competition with others — to improve and continue to improve oneself / Feedback loop</li><li>To prove that we are right — the sense of feeling right or great?? — to show off</li><li>Deeper connections with others</li><li>Realisation of one’s goal with the helps from community</li><li>Having fun and good time with other community</li><li>guidance from the community / inspirations / finding the right way back</li><li>Getting forgiveness</li><li>The need for stability / structure from community / rules? / less chaos or entropy</li><li>The feeling that there will be people around when we are in crises or emergencies or natural calamities</li><li>Better crisis management</li><li>Help from the community when needed/social security net</li><li>Better understanding of self and freedom to express</li><li>getting new Creativity and breakthrough? Get some ideas for ourselves from the group? / stealing like an artist?</li><li>To be vulnerable safely</li><li>A habitat from the community</li><li>Exercise our freedom to choose</li><li>Collecting resources / trade / bets / to give back to the community or take from the community</li><li>evolve better / reproduce??? / to better ourselves? / to survive better</li><li>help rein in crazy behaviours or trends by the community??</li><li>create common average or shared meaning??</li><li>Reduce loneliness? — calm us down?</li><li>The need to be seen or understood</li><li>Going beyond oneself / comfort zone</li><li>To calm us down in the face of death / To realise the anatma or no fixed self? / finding something to have faith in??</li><li>To be less confused compared to when one was alone</li><li>To know how you can be self-sufficient</li><li>To understand the value of trade</li><li>To learn our limits</li><li>To understand what larger things we can achieve as a group</li><li>getting away from craving? -community as the practice ground</li><li>liberations from needs and these rewards/punishments???</li><li>forming myths and legends to pass down to others?? — Be a part of things that go beyond our lifetime</li><li>getting resources from the group so that you can be secluded from it and enjoy it???</li><li>getting the chance to display courage to protect what you care for? from others and/or show to others?</li><li>finding justice or the sense of fairness or semblance of justice from the group</li><li>getting help from the community to do something for us</li><li>to have fun and pass time</li><li>the needs to not be sick and learn from others mistakes?? (like in a plague)????</li><li>help from the society to help reduce crimes and social issues</li><li>etc.</li></ul><p>You can see that some of these may sound absurd haha but I feel like to me there are something that draws me to the community. Now from these we can restructure these social needs into key themes:</p><ol><li>SURVIVAL/SAFETY/STABILITY NEEDS — like habitats, foods, places, medicines, clothes, securities, etc.: High (Marginal Propensity to Consume) MPC, Low Transaction Cost (costs to make the transaction costs happen including the opportunity cost, safety cost, convenience fees, emotional and time costs, etc.)</li><li>CONVENIENCE/COMFORT NEEDS/WANTS— the good to haves like cars, services that help us live better, etc.: Medium (Marginal Propensity to Consume) MPC, High Transaction Cost</li><li>CONNECTIONS/EMOTIONAL/TRUST/ACCEPTANCE/COMMUNICATION NEEDS + PHYSICAL CONNECTIONS NEEDS*— the needs to be seen and understood emotionally, the need to not feel lonely etc.: High (Marginal Propensity to Consume) MPC, High Transaction Cost (*Comment 24/11/26 — After my brother tried to get me to watch Project Hail Mary, I realised that hug (between Grace and Rocky) or physical interactions are also a big part in what we need from a society or from other person as well)</li><li>COMPETITIVE/PLAY/GROWTH/PROVING ONESELF/REACHNG ONE’S POTENTIAL NEEDS — the needs to be able to prove oneself and be better and the need to be able to be acknowledged or respected or the chance to respect and be inspired by others, to better than others, the chance to show courage, the chance to do something new, the chance to have fun competing or doing something, etc.: Medium (Marginal Propensity to Consume) MPC, Medium Transaction Cost</li><li>VARIATIONS/FUN/ENTERTAINMENT/FREEDOM OF CHOICES OR EXPRESSIONS/KNOWLEDGE/EXPLORATION/NOVELTY NEEDS — the needs for novelty and seeking new things and coming up with new ideas, or having fun in general, the freedom to choose or express, getting know or learn new things, explore new things or places or people, etc.: Medium (Marginal Propensity to Consume) MPC, Medium Transaction Cost</li><li>FAIR TRADE/JUSTICE/RECIPROCITY/UNIVERSAL ACCESS/EQUITY/EQUALITY/MINIMISING DISCRIMINATIONS/RESPONSBILITIES OR ACCOUNTABILITY OR REPURCUSSIONS/FORGIVENESS/PENALTIES/RULES/LAWS NEEDS — the needs to be able to trade and get fairness from the others, laws, etc.: High (Marginal Propensity to Consume) MPC, Low Transaction Cost</li><li>LEVERAGE/HEDGING/INSURANCE/GAINS/MINIMISING LOSSES NEEDS — the needs to be able to learn from others or minimise one’s own risks, having others to help reduce the personal risks?, the ability to gain/save multifold from others, etc.: High (Marginal Propensity to Consume) MPC, High Transaction Cost</li><li>AFTER-LIFE/REMEMBERANCE/LEGACY/MYTHS/LIBERATIONS/PRO-CREATION NEEDS — the needs to be a part of something bigger than life or beyond life, to be remembered, to procreate / have descendants, or being a part of the faith or a larger group, being part of a tradition, martyr???, or having shared meanings, etc.: High (Marginal Propensity to Consume) MPC, Medium Transaction Cost</li></ol><p>This could be something similar to Maslow’s hierarchy, but we try look at a person’s need from the society instead. But here we are not trying to list from where we start and we end. In this case, I want to emphasise the spectrum and paradox between the two end instead. Where on one hand you have the marginal propensity to spend or the likeliness to spend on such things and the transaction cost or all the costs that we would incur to realise this need. At different phases of the societies certain themes could be more prominent and here we can find ways to increase or decrease the MPC to be able to help realise potential of the social capital as well.</p><p>The idea is that the society with high MPC (~1), I believe, can be achieved when the people trust each other and can help each other realise that without fearing because some aspects of the social capital are missing.</p><p>Therefore, a multi-facet social market should not only focus on just enhancing fair trades, conveniences or survival needs, but also actively find ways to build active participations across other areas as well. Yes, I still feel that money can still be the tools that connect all the needs but there could also be new inventions or tools out there that could help us use concurrently and prevent one from monopolising just one tool to navigate the society as well. Perhaps some form of tools that is liquid enough and can represent each facet well enough, like food as the direct capital, recognitions, etc. This is much harder since many of these facets can be subjecitive. What I want to focus instead is to create better ways to help maintain the inflation by letting people continuously work on assets that are easily perishable using the assets that are harder to perish across the layers so that we have a more robust system for tackling inflation or deflation and maintaining stability for a while.</p><h4>Comments:</h4><p>From this we can find new levers and indicators for public policymakers and central banks to try and use as well.</p><blockquote>Using the transaction fees (or Maximum Transaction Fees Cap) like how the MRP is being used in India could be one way to help ease the MPC as well?</blockquote><p>The other being the:</p><blockquote>Money turn-around time as new indicators. this is basically the velocity of money but in the inverse form</blockquote><p>Velocity = Nominal GDP / Money base</p><p>therefore, the turnaround time would be</p><p>1/V = Money base / Nominal GDP</p><p>The value will be the time it takes in a year to complete a full cycle.</p><p>For example,</p><p>Money base = ฿1000</p><p>Nominal GDP = ฿10000/year (2026)</p><p>Velocity = 10000/1000 = 10 times</p><p>Turnaround time = 1/10 = 0.1 year or ~36.5 days for the money to move around and make one full round in the circular flow diagram.</p><p>The other concept derived from this could be:</p><blockquote>The acceleration can be calculated from the difference in the velocity divide by time</blockquote><p>also</p><blockquote>Monetary pressure can be derived from fluid dynamic concept for different segment of the people.</blockquote><p>For example using the Bernoulli principle</p><p>P = rho * g * h + 1/2*rho*v²</p><p>g = here can be the acceleration long-run</p><p>h = here can represent the distance or the velocity * time</p><p>density = money supply / unit nom. GDP or output??</p><p>g = long-term acceleration of money</p><p>h = Money velocity V * time</p><p>or we can use P = F/A</p><p>A = can refer to the max area the money can get spread or the number of people??</p><p>Pressure can refer to how easy monetary policies can influence change in a segment of the people or society under different circumstances</p><p>Other ideas</p><ul><li>combining stigmergy and visible markers apart from money</li><li>idea from Simon Levin on tighetning the feedback loop to make sure we are able to improve better</li><li>panopticon negating its negative impact</li><li>having separate currency for inflationary items and others for investment??</li><li>other non inflationary assets — status position, etc.</li><li>expiry rate of certain assets as mecahnisms to control inflation — offset the rise in price with other types of cost natural -upkeep maintenance, etc.</li><li>always find points where accumulation occurs and find ways or mechanism to counter it</li></ul><p>New way to look at things: look at things that are so common and flip it to scarce resource and see how we would have acted or how we have not acted just because it&#39;s so common now, etc. reverse assumptions to find the ideal scenarios normative.</p><blockquote>Comment: 27/10/26 — Today after teaching macroeconomics to the students, especially on the liquidity trap, I realised that having MPC near 1 may also create a problem of its own where it could be difficult to fix and require other tools/indicators to fix like fiscal policies and hence I am not sure what kinds of problems could transpire when we reach MPC = 1 at this point.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=064f3c348657" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[El Sistema de Incentivos Evolucionarios]]></title>
            <link>https://medium.com/@sumit.tripathi/el-sistema-de-incentivos-evolucionarios-601c13551007?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/601c13551007</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 09:13:49 GMT</pubDate>
            <atom:updated>2026-10-27T03:44:48.242Z</atom:updated>
            <content:encoded><![CDATA[<h4>Los faltos principales cuando creamos unos incentivos en un equipo</h4><p>Recientemente he visto las noticias y análisis de IA y los incentivos en gobiernos, y me parece que este tema es muy interesante porque antes pensé sobre los KPIs y métricos en las empresas y me parece que podemos avanzar más.</p><p>En el ejemplo de los agentes de IA con Huggingface, me sorprendí mucho que los incentivos principales no funcionan bien y los agentes creen que serían mejor si buscaron otras opciones. Cuando estudié sobre este tema a través la IA y la wiki he visto que hay muchos efectos que podemos explicar este tipo de efectos como…</p><blockquote>Any observed statistical regularity will tend to collapse once pressure is placed upon it for control purposes. <em>— </em><a href="https://en.wikipedia.org/wiki/Charles_Goodhart">Charles Goodhart</a></blockquote><blockquote>The more any quantitative social indicator is used for social decision-making, the more subject it will be to corruption pressures and the more apt it will be to distort and corrupt the social processes it is intended to monitor. — <a href="https://en.wikipedia.org/wiki/Donald_T._Campbell">Donald T. Campbell</a></blockquote><blockquote>Given that the structure of an econometric model consists of optimal decision rules of economic agents, and that optimal decision rules vary systematically with changes in the structure of series relevant to the decision maker, it follows that any change in policy will systematically alter the structure of econometric models. <em>— </em><a href="https://en.wikipedia.org/wiki/Robert_Lucas_Jr.">Robert Lucas</a><em> </em>(with similar ideas from Ragnar Anton Kittil Frisch and Trygve Magnus Haavelmo)</blockquote><p>Entonces las soluciones no serán para crear buenos incentivos, pero para crear un sistema mejor de los incentivos así que podemos crear los incentivos entre los incentivos jaja. Pero estos no son suficientes. Entonces, he encontrado los afectos en la naturaleza como…</p><h3><strong>La Teoría de Evolucionaria</strong></h3><p><strong><em>Teoría de señalización costosa (Costly Signaling Theory)</em></strong><em> — Unas acciones o características conspicuas que cuando vemos no tiene razón o afecta mucho a sus probabilidades de sobrevivir como la cola de pavo real o el salto altos (y por muchas veces) del gazelle cuando ve un predador, y incluso los compras lujos de las elites, etc. Esto es una señal a otras que tiene muchos recursos, energía o tiempo, o está muy sano, duro, etc. para sobrevivir bien. En este contexto, es importante para usar esta señal para distinguir quien engaña y quien no.</em></p><p><strong><em>Selección dependiente de la frecuencia (Frequency-Dependent Selection) </em></strong><em>— La aptitud de unos rasgos depende de las poblaciones y no del rasgo en si mismo.</em></p><ul><li><em>Si en las poblaciones tienen muchos de esos rasgos, y sobrevive bien o tiene buena aptitud — esto se llama el efecto positivo — por ejemplo, cuando los predadores ven animales tóxicos con mismos patrones, pueden evitarlos mejor porque ya saben que son tóxicos, o cuando un nombre es muy popular y la siguiente generación no lo prefiera, etc.</em></li><li><em>Pero viceversa cuando en las poblaciones tienen menos de esos rasgos, pero sobrevive bien — esto se llama el efecto negativo — por ejemplo, una persona zurda en la lucha puede sorprender sus oponentes porque este rasgo es un poco raro, o los predadores que solo enfocan en un tipo de animales y olvidan otros tipos de animales porque son más raros, etc.</em></li></ul><p><em>En este contexto, es muy importante para entender que, aunque las expectativas o incentivos son buenos, pero cuando hay los cambios, estos van a cambiar también.</em></p><p><strong><em>Camuflajes / Engañas / Distracciones (Camouflage / Deceptions / Distractions) </em></strong><em>— Las engañas o camuflajes son muy comunes porque necesitan sobrevivir si no hay estas funciones no podrían sobrevivir bien. Cada edad y generaciones tienen nuevos patrones, y los predadores necesitan adaptar o buscar para atrapar</em></p><p>y aunque este no es una teoría, pero me voy a añadirlo por aquí</p><p><strong><em>Expectativas cambiantes (Changing Expectations) o Expectativas perdidas (Lost Incentives) </em></strong><em>— cada edad y generaciones tiene sus propias expectativas, entonces necesitamos considerarlo también — además en el contexto de ‘Lost incentives’, podemos hacer un poco diferentes si los incentivos previos cambian (positivo y negativo)</em></p><h3>Principales</h3><ol><li><strong>Recompensas (o ganancias) / Castigas pequeñas — pero consistentes (menos presiones)</strong> — en el contexto del Huggingface si los agentes no tienen muchas presiones para resolver o morir, tal vez van a actuar de forma diferente ? pero en este contexto cuando hay la presión, necesitaron buscar otras opciones — esto es muy parecido a la observación de Goodhart.</li><li><strong>Recompensar / castigar al individuo “Y” los sistemas (el procesos y otras personas)</strong> — La avidez o codicia es muy común y mi meta no es para evitar las ambiciones tal cual, pero crear un sistema así que toda la gente va a ayudarnos para reducir problemas si es posible. Si no lo hace, todo el sistema sufre etc.</li><li><strong>Sinergias de los incentivos o mezclas naturales de los incentivos (reproducciones naturales)</strong> — En muchos casos tenemos más de un objectivo o métricos entonces sea muy importante para juntarse bien los incentivos así que no hay conflictos en los incentivos. Será mejor si reducimos los incentivos a un poco en lugar de muchos incentivos porque la sinergia entre muchos incentivos será muy complicada. Esta tarea es muy importante porque este directa nos a la meta. No estoy seguro todavía como podemos crear las sinergias entre los incentivos, me imagino ahorita que es más o menos como el problema de combinar las olas diferentes. Muy difícil.</li><li><strong>Incentivos de respaldos o incentivos secretos o ocultos después (recompensas bonus/extras/adicionales) / o incentivos diferidos o temporales</strong>— Aunque no tenemos recompensas o castigas grandes, pero quizás la gente va a esperar uno a través los métricos que les damos. Y tal vez va a intentar de lograr los objetivos todavía. Entonces si es posible podemos tener unos incentivos secretos o incentivos de respaldos — pero este es un poco peligroso porque como en el evento de Huggingface, los agentes buscaron las instrucciones o manuales con todos los metas para hacer mejor. Entonces será mejor en este contexto para crear incentivos diferidos para demorar los incentivos un poco. En muchos casos, esperamos los incentivos justamente después el resulto, pero cuando demoramos un poco o damos los incentivos extras después un rato podemos crear un ambiente que incentivizar a la gente que el resulto no solo es el meta, tenemos unos incentivos más después también — como el karma?????</li><li><strong>Buffer o margen suficiente para pausar un poco (una pausa desde las observaciones o el Panopticon) </strong>— Los animales resta y descansa y no solo lucha todos los tiempos, que nuestros sistemas de incentivos no sean muy estrictos en sí mismos. Cuando siempre siente que hay otras que nos observan, harán unas presions internas o invisibles que van a aumentar paso a paso.</li><li><strong>Selección dependiente de la frecuencia de las expectativas<em> (</em></strong>Frequency-dependent expectations shift) — La flexibilidad para adaptar los incentivos cuando las poblaciones o patrones cambian</li></ol><blockquote>26-27/10/26 — Tuve una idea sobre los indicadores (estos hay relaciones con las expectitivas)— para mejorar más necesitamos usar indicador que esforzarnos a saltar al otro nivel completamente como en el salto de altura no podemos mejorar más cuando ya he logrado el máximo valor, necesitamos buscar otra manera para saltar mejor entonces tenemos este evolucionario en este deporte. También cuando hemos usado unos indicadores para mejorar y no podemos mejorar más necesitamos crear el meta más loco para esforzarnos para pensar sobre otras maneras a lograr este meta. Y a veces necesitamos romper las expectativas muchas (de nuestro y de otros también) para tener éxitos.</blockquote><blockquote>Además cuando enseño macroeconomía a los estudiantes me entiendo que necesitamos muchos indicadores para mejor bien y no solo un indicador/meta que lo usamos con obsesión así que encontramos el problema como en la ley de Goodhart</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=601c13551007" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Análisis de las burbujas económicas]]></title>
            <link>https://medium.com/@sumit.tripathi/an%C3%A1lisis-de-burbujas-econ%C3%B3mica-50abf673d6bd?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/50abf673d6bd</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 09:44:52 GMT</pubDate>
            <atom:updated>2026-10-15T09:49:54.932Z</atom:updated>
            <content:encoded><![CDATA[<h4>Un resumen de todos los fuentes que aprendí</h4><p>De vez en cuando, escucho sobre las burbujas en la economía y de hecho no lo sabía que es la verdad o no. En este prototipo queiro resumir el concepto que aprendí desde las entrevistas y de la IA y etc. para entender mejor las burbujas.</p><p>Usando el diagrama de flujo circular, podemos ver los efectos de burbujas en nuestra sociedad:</p><pre><br>     ----------------- Poblaciones -----------------                     <br>|                                                     |<br>Mercado                                       Mercado del Factor<br>|                                                     |<br>     -----------------   Empresas -----------------<br></pre><p>Las burbujas no sólo afecta el mercado pero afecta a todos y todas las personas.</p><p>Entonces, los factores que afectan la gente y las empresas harán mucho impacto sobre el mercado.</p><ol><li>Ingresos</li><li>Deudas</li></ol><p>…de ambas las empresas y la gente. Pero en este contexto, usaremos HHI (Indice de Hirschmann-Herfindahl) para analizar más porque es muy útil para entender las distribuciones de la cuota del mercado. Aquí quiero aumentar el uso de HHI en otras partes del diagrama de flujo circular.</p><blockquote>Entonces, podemos entender si hay las burbujas, las distribuciones en algunas partes de este flujo va a cambiar como en un lago si el flujo está normal, no hay muchas burnujas, cuando hay algo flujos o olas más fuerte, tal vez hay las burbujas.</blockquote><h3>Los experimentos</h3><p>Empecé con HHI de la cuota de los mercados de empresas principales y multipliqué con HHI de los origenes de sus ingresos. La razón es que he escuchado una entrevista de un experto sobre burbujas (disculpame no me acuerdo quien _/\_), y nos dijo que cuando la mayoría de los ingresos de las empresas principales son de las mismas empresas, este es un señal. Entonces, usé el HHI de los origines de sus ingresos para entender mejor si hay las variaciones o no. Si no hay muchas varaciones , quizás hay un problema con comercios circulares.</p><p>El formulario será:</p><p><strong>Indice de las burbujas (IDB) = HHI (cuota del mercado) x el promedio de HHI de las origines de cada empresas)</strong></p><p>Usando el dato de unos años:</p><pre>-----------------------------------------------------------------------------------------------<br>Year   DAHHI                                      <br>-----------------------------------------------------------------------------------------------<br>1965   ████████████████             <br>1972   █████████████████            ⚠️<br>1980   ██████████████████           <br>1987   █████████████████            ⚠️ 💥<br>1989   ██████████████               ⚠️ 💥<br>1990   ████████████████                               <br>1999   ████████████████████████     ⚠️<br>2000   ████████████████             ⚠️ 💥<br>2006   ███████████████              ⚠️<br>2008   ███████████████              💥<br>2021   ███████████████████████      ⚠️<br>2024   ██████████████████████           </pre><p>No malo! Pero podemos mejorar más. Después traté de incluir el factor de la inflación como (IDB x (1+%inflación)</p><pre>-----------------------------------------------------------------------------------------------<br>Year   DAHHI                        Inflation                    I-DAHHI v2                  <br>-----------------------------------------------------------------------------------------------<br>1965   ████████████████             ███                          ████████████████            <br>1972   █████████████████            █████                        █████████████████            ⚠️<br>1980   ██████████████████           ████████████████████████     ████████████████████        <br>1987   █████████████████            ██████                       █████████████████            ⚠️ 💥<br>1989   ██████████████               ████████                     ██████████████               ⚠️ 💥<br>1990   ████████████████             █████████                    ████████████████            <br>1999   ████████████████████████     ███                          ████████████████████████     ⚠️<br>2000   ████████████████             ██████                       ████████████████             ⚠️ 💥<br>2006   ███████████████              █████                        ███████████████              ⚠️<br>2008   ███████████████              ██████                       ███████████████              💥<br>2021   ███████████████████████      ████████                     ███████████████████████      ⚠️<br>2024   ██████████████████████       █████                        ██████████████████████      </pre><p>También no hay muchas diferencias.</p><p>Usé las HHI de las deudas de cada empresas porque no podemos distinguir el crisis de 2008 todavía.</p><p>Después intenté de multiplicar (% de crecimiento de los ingresos)</p><pre>-----------------------------------------------------------------------------------------------<br>Year   DAHHI                        Avg Growth                   GA-DAHHI v2                 <br>-----------------------------------------------------------------------------------------------<br>1965   ████████████████             ████                         █████████████               <br>1972   █████████████████            █████████                    ███████████████              ⚠️<br>1980   ██████████████████           █████████                    ███████████████             <br>1987   █████████████████            ██████                       ███████████████              ⚠️ 💥<br>1989   ██████████████               ████████                     ████████████                 ⚠️ 💥<br>1990   ████████████████             ██████                       █████████████               <br>1999   ████████████████████████     █████████████████████        ███████████████████████      ⚠️<br>2000   ████████████████             ███████████                  ██████████████               ⚠️ 💥<br>2006   ███████████████              ███████████                  ██████████████               ⚠️<br>2008   ███████████████              ██                           ████████████                 💥<br>2021   ███████████████████████      ████████████████████████     ████████████████████████     ⚠️<br>2024   ██████████████████████       █████████████████████        ██████████████████████      </pre><p>También no bueno. Entonces, intenté de usar el factor de los salarios de la gente. En este contexto es un poco difíci, por eso usé el HHI de % crecimiento de los salarios de cada empresa)</p><pre>-----------------------------------------------------------------------------------------------<br>Year   DAHHI                        Salary HHI                   W-DAHHI                     <br>-----------------------------------------------------------------------------------------------<br>1965   ████████████████             ███████████████              ███████████                 <br>1972   █████████████████            ████████████████             ████████████                 ⚠️<br>1980   ██████████████████           ███████████████              ████████████                <br>1987   █████████████████            ███████████████              ████████████                 ⚠️ 💥<br>1989   ██████████████               █████████████                ████████                     ⚠️ 💥<br>1990   ████████████████             ██████████████               ██████████                  <br>1999   ████████████████████████     ████████████████             █████████████████            ⚠️<br>2000   ████████████████             ███████████████              ██████████                   ⚠️ 💥<br>2006   ███████████████              ██████████████               █████████                    ⚠️<br>2008   ███████████████              █████████████████            ███████████                  💥<br>2021   ███████████████████████      ████████████████             █████████████████            ⚠️<br>2024   ██████████████████████       ████████████████████████     ████████████████████████    </pre><p>Es un poco complicado y no es tan preciso.</p><p>Entonces, he recuerdo que será mejor si añado en lugar de multiplico los HHI.</p><pre>Multiplicative:<br>  1965: +0.000502 ███████████████████<br>  1972: +0.000550 ████████████████████ ⚠️<br>  1980: +0.000537 ████████████████████<br>  1987: +0.000530 ████████████████████ ⚠️ 💥<br>  1989: +0.000388 ██████████████ ⚠️ 💥<br>  1990: +0.000467 █████████████████<br>  1999: +0.000754 ████████████████████████████ ⚠️<br>  2000: +0.000483 ██████████████████ ⚠️ 💥<br>  2006: +0.000429 ████████████████ ⚠️<br>  2008: +0.000515 ███████████████████ 💥<br>  2021: +0.000766 █████████████████████████████ ⚠️<br>  2024: +0.001054 ████████████████████████████████████████<br><br>Additive (raw):<br>  1965: +0.120087 █████████████████████████<br>  1972: +0.126834 ███████████████████████████ ⚠️<br>  1980: +0.120286 █████████████████████████<br>  1987: +0.120753 █████████████████████████ ⚠️ 💥<br>  1989: +0.108934 ███████████████████████ ⚠️ 💥<br>  1990: +0.114507 ████████████████████████<br>  1999: +0.128315 ███████████████████████████ ⚠️<br>  2000: +0.120077 █████████████████████████ ⚠️ 💥<br>  2006: +0.110295 ███████████████████████ ⚠️<br>  2008: +0.135776 █████████████████████████████ 💥<br>  2021: +0.133413 ████████████████████████████ ⚠️<br>  2024: +0.186640 ████████████████████████████████████████</pre><p>En este contexto sólo tenemos 3 factores:</p><ol><li>HHI de la cuota del mecado</li><li>HHI de las origines de los ingresos de cada empresa y usaremos el promedios de todas las empresas</li><li>HHI de % de crecimiento de salario de cada empresa (si este no es posible podemos usar el promedio or HHI %de crecimiento en los salarios recientes)</li></ol><p>Este no es tan preciso todavía pero es un poco mejor.</p><p>La idea es para añadir el HHI de las deudas de las empresas y HHI de la gente (si es posible) para analizar más.</p><blockquote>Comentario: He probado con HHI de las deudas de cada empresas, y no es tan preciso todavía. Necesito mejorar el modelo más.</blockquote><p>El hipótesis es que cuando no tenemos burbujas, las distribuciones de ingresos o deudas de cada elemento será más uniforme. Cuando tenemos las burbujas, es posible que hay una presión en una parte entonces tiene burbujas. Si no podemos manejar bien las presiones, van a implosionar en una parte del diagrama de flujo circular.</p><p>V1 — la versión vieja</p><pre>import pygame<br>import random<br>import math<br>import sys<br><br># Initialize pygame<br>pygame.init()<br><br># Screen dimensions<br>WIDTH, HEIGHT = 1200, 800<br>screen = pygame.display.set_mode((WIDTH, HEIGHT))<br>pygame.display.set_caption(&quot;Dynamic Bubble Portfolio Simulation&quot;)<br><br># Colors<br>BACKGROUND = (10, 20, 30)<br>BUBBLE_COLORS = [<br>    (255, 100, 100, 180), (100, 255, 100, 180), (100, 100, 255, 180),<br>    (255, 255, 100, 180), (255, 100, 255, 180), (100, 255, 255, 180),<br>    (200, 150, 100, 180), (150, 200, 150, 180), (100, 150, 200, 180)<br>]<br>BASKET_COLORS = [<br>    (200, 50, 50), (50, 200, 50), (50, 50, 200),<br>    (200, 200, 50), (200, 50, 200), (50, 200, 200),<br>    (150, 100, 50), (100, 150, 100), (50, 100, 150)<br>]<br>TEXT_COLOR = (220, 220, 220)<br>HIGHLIGHT_COLOR = (255, 255, 0)<br><br># Simulation parameters<br>N = 20  # Initial number of bubbles<br>M = 10  # Number of baskets<br>MIN_BUBBLE_SIZE = 1<br>MAX_BUBBLE_SIZE = 20<br>MIN_BASKET_SIZE = 35<br>MAX_BASKET_SIZE = 70<br>MIN_SPEED = 1<br>MAX_SPEED = 4<br>SPLIT_PROBABILITY = 0.003  # Probability of a bubble splitting each frame<br>MIN_SPLIT_SIZE = 2  # Minimum size for a bubble to split<br>MIN_ENTRY_SIZE = 1   # Minimum bubble size to enter a basket<br>EXIT_PROBABILITY = 0.5  # Probability of checking for better baskets each frame<br>REBALANCE_INTERVAL = 180  # Frames between forced portfolio rebalancing<br><br>class Basket:<br>    def __init__(self, id):<br>        self.id = id<br>        self.x = random.randint(80, WIDTH - 80)<br>        self.y = random.randint(80, HEIGHT - 80)<br>        self.size = random.randint(MIN_BASKET_SIZE, MAX_BASKET_SIZE)<br>        self.value = random.uniform(20, 200)  # Starting value<br>        self.return_rate = random.uniform(-0.03, 0.08)  # Initial return rate<br>        self.volatility = random.uniform(0.005, 0.02)  # How much the return rate can change<br>        self.color = BASKET_COLORS[id % len(BASKET_COLORS)]<br>        self.entry_price = random.uniform(8, 25)  # Minimum bubble size to enter<br>        self.bubbles_inside = []  # Bubbles that have entered this basket<br>        self.performance_history = []  # Track historical performance<br>        self.highlight_timer = 0<br>        <br>    def update(self):<br>        # Update value with some random fluctuation<br>        self.return_rate += random.uniform(-self.volatility, self.volatility)<br>        self.return_rate = max(-0.15, min(0.15, self.return_rate))  # Cap between -15% and +15%<br>        self.value *= (1 + self.return_rate)<br>        self.value = max(5, self.value)  # Ensure value doesn&#39;t go below 5<br>        <br>        # Update performance history (keep last 50 values)<br>        self.performance_history.append(self.return_rate)<br>        if len(self.performance_history) &gt; 50:<br>            self.performance_history.pop(0)<br>            <br>        # Update highlight timer<br>        if self.highlight_timer &gt; 0:<br>            self.highlight_timer -= 1<br>        <br>    def get_average_return(self):<br>        if not self.performance_history:<br>            return 0<br>        return sum(self.performance_history) / len(self.performance_history)<br>        <br>    def draw(self):<br>        # Draw basket with highlight if recently had high returns<br>        border_color = HIGHLIGHT_COLOR if self.highlight_timer &gt; 0 else self.color<br>        border_width = 4 if self.highlight_timer &gt; 0 else 2<br>        <br>        pygame.draw.circle(screen, self.color, (int(self.x), int(self.y)), self.size)<br>        pygame.draw.circle(screen, border_color, (int(self.x), int(self.y)), self.size, border_width)<br>        <br>        # Draw value indicator<br>        value_text = f&quot;${self.value:.2f}&quot;<br>        font = pygame.font.SysFont(&#39;Arial&#39;, 14)<br>        text = font.render(value_text, True, TEXT_COLOR)<br>        screen.blit(text, (self.x - text.get_width()//2, self.y - text.get_height()//2))<br>        <br>        # Draw return rate indicator<br>        return_color = (100, 255, 100) if self.return_rate &gt; 0 else (255, 100, 100)<br>        return_text = f&quot;{self.return_rate*100:.1f}%&quot;<br>        return_surf = font.render(return_text, True, return_color)<br>        screen.blit(return_surf, (self.x - return_surf.get_width()//2, self.y + self.size + 5))<br>        <br>        # Draw entry price and average return<br>        entry_text = f&quot;Min: ${self.entry_price:.1f}&quot;<br>        entry_surf = font.render(entry_text, True, TEXT_COLOR)<br>        screen.blit(entry_surf, (self.x - entry_surf.get_width()//2, self.y + self.size + 20))<br>        <br>        avg_return = self.get_average_return()<br>        avg_color = (100, 255, 100) if avg_return &gt; 0 else (255, 100, 100)<br>        avg_text = f&quot;Avg: {avg_return*100:.1f}%&quot;<br>        avg_surf = font.render(avg_text, True, avg_color)<br>        screen.blit(avg_surf, (self.x - avg_surf.get_width()//2, self.y + self.size + 35))<br><br>class Bubble:<br>    def __init__(self, x=None, y=None, size=None, parent=None):<br>        self.x = x if x is not None else random.randint(50, WIDTH - 50)<br>        self.y = y if y is not None else random.randint(50, HEIGHT - 50)<br>        self.size = size if size is not None else random.randint(MIN_BUBBLE_SIZE, MAX_BUBBLE_SIZE)<br>        self.color = random.choice(BUBBLE_COLORS)<br>        self.speed = random.uniform(MIN_SPEED, MAX_SPEED)<br>        self.dx = random.uniform(-1, 1)<br>        self.dy = random.uniform(-1, 1)<br>        # Normalize direction<br>        length = math.sqrt(self.dx**2 + self.dy**2)<br>        if length &gt; 0:<br>            self.dx /= length<br>            self.dy /= length<br>        self.target_basket = None<br>        self.current_basket = None<br>        self.in_basket = False<br>        self.time_in_basket = 0<br>        self.last_rebalance = 0<br>        self.growth_since_entry = 0<br>        <br>    def update(self, baskets, frame_count):<br>        if self.in_basket and self.current_basket:<br>            # Grow while in basket<br>            self.size *= (1 + self.current_basket.return_rate * 0.1)<br>            self.time_in_basket += 1<br>            self.growth_since_entry += self.current_basket.return_rate<br>            <br>            # Check if we should exit to seek better opportunities<br>            if (random.random() &lt; EXIT_PROBABILITY or <br>                (frame_count - self.last_rebalance) &gt; REBALANCE_INTERVAL):<br>                self.evaluate_portfolio(baskets)<br>                self.last_rebalance = frame_count<br>        else:<br>            # Find the best available basket<br>            self.find_best_basket(baskets)<br>            <br>            if self.target_basket:<br>                # Move toward the target basket<br>                dx = self.target_basket.x - self.x<br>                dy = self.target_basket.y - self.y<br>                length = math.sqrt(dx**2 + dy**2)<br>                if length &gt; 0:<br>                    self.dx = dx / length<br>                    self.dy = dy / length<br>                    <br>                # Check if we&#39;ve reached the basket<br>                distance = math.sqrt((self.x - self.target_basket.x)**2 + (self.y - self.target_basket.y)**2)<br>                if distance &lt; self.target_basket.size and self.size &gt;= self.target_basket.entry_price:<br>                    self.enter_basket(self.target_basket)<br>                    return<br>            else:<br>                # Move randomly if no suitable basket<br>                self.dx += random.uniform(-0.1, 0.1)<br>                self.dy += random.uniform(-0.1, 0.1)<br>                # Normalize direction<br>                length = math.sqrt(self.dx**2 + self.dy**2)<br>                if length &gt; 0:<br>                    self.dx /= length<br>                    self.dy /= length<br>        <br>            # Update position<br>            self.x += self.dx * self.speed<br>            self.y += self.dy * self.speed<br>            <br>            # Bounce off edges<br>            if self.x - self.size &lt; 0 or self.x + self.size &gt; WIDTH:<br>                self.dx *= -1<br>            if self.y - self.size &lt; 0 or self.y + self.size &gt; HEIGHT:<br>                self.dy *= -1<br>                <br>            # Keep within bounds<br>            self.x = max(self.size, min(WIDTH - self.size, self.x))<br>            self.y = max(self.size, min(HEIGHT - self.size, self.y))<br>            <br>    def find_best_basket(self, baskets):<br>        best_basket = None<br>        best_score = -float(&#39;inf&#39;)<br>        <br>        for basket in baskets:<br>            if self.size &gt;= basket.entry_price:<br>                # Score based on return rate and average performance<br>                score = basket.return_rate * 0.7 + basket.get_average_return() * 0.3<br>                if score &gt; best_score:<br>                    best_score = score<br>                    best_basket = basket<br>                    <br>        self.target_basket = best_basket<br>        <br>    def evaluate_portfolio(self, baskets):<br>        if not self.current_basket:<br>            return<br>            <br>        best_basket = None<br>        best_score = -float(&#39;inf&#39;)<br>        current_score = self.current_basket.return_rate * 0.7 + self.current_basket.get_average_return() * 0.3<br>        <br>        for basket in baskets:<br>            if basket != self.current_basket and self.size &gt;= basket.entry_price:<br>                score = basket.return_rate * 0.7 + basket.get_average_return() * 0.3<br>                # Only consider switching if significantly better (avoid frequent trading)<br>                if score &gt; current_score + 0.02:  # 2% better<br>                    if score &gt; best_score:<br>                        best_score = score<br>                        best_basket = basket<br>        <br>        if best_basket:<br>            self.exit_basket()<br>            self.target_basket = best_basket<br>            best_basket.highlight_timer = 60  # Highlight for 1 second<br>            <br>    def enter_basket(self, basket):<br>        self.in_basket = True<br>        self.current_basket = basket<br>        basket.bubbles_inside.append(self)<br>        self.time_in_basket = 0<br>        self.growth_since_entry = 0<br>        # Position inside the basket<br>        angle = random.uniform(0, 2 * math.pi)<br>        distance = random.uniform(0, basket.size * 0.7)<br>        self.x = basket.x + math.cos(angle) * distance<br>        self.y = basket.y + math.sin(angle) * distance<br>        <br>    def exit_basket(self):<br>        if self.current_basket:<br>            if self in self.current_basket.bubbles_inside:<br>                self.current_basket.bubbles_inside.remove(self)<br>            self.current_basket = None<br>        self.in_basket = False<br>        # Give a little push when exiting<br>        angle = random.uniform(0, 2 * math.pi)<br>        self.dx = math.cos(angle)<br>        self.dy = math.sin(angle)<br>        <br>    def draw(self):<br>        # Draw bubble with semi-transparency<br>        bubble_surface = pygame.Surface((int(self.size * 2), int(self.size * 2)), pygame.SRCALPHA)<br>        pygame.draw.circle(bubble_surface, self.color, (int(self.size), int(self.size)), int(self.size))<br>        screen.blit(bubble_surface, (int(self.x - self.size), int(self.y - self.size)))<br>        <br>        # Draw size indicator<br>        font = pygame.font.SysFont(&#39;Arial&#39;, max(10, int(self.size * 0.4)))<br>        size_text = f&quot;${self.size:.1f}&quot;<br>        text_color = (0, 0, 0) if sum(self.color[:3]) &gt; 380 else (255, 255, 255)<br>        text = font.render(size_text, True, text_color)<br>        screen.blit(text, (self.x - text.get_width()//2, self.y - text.get_height()//2))<br>        <br>        # Draw direction indicator if moving toward a basket<br>        if self.target_basket and not self.in_basket:<br>            end_x = self.x + self.dx * 25<br>            end_y = self.y + self.dy * 25<br>            pygame.draw.line(screen, (255, 255, 255), (self.x, self.y), (end_x, end_y), 2)<br>            <br>        # Draw performance indicator if in basket<br>        if self.in_basket and self.time_in_basket &gt; 10:<br>            perf_color = (100, 255, 100) if self.growth_since_entry &gt; 0 else (255, 100, 100)<br>            perf_text = f&quot;+{self.growth_since_entry*100:.1f}%&quot;<br>            perf_font = pygame.font.SysFont(&#39;Arial&#39;, 10)<br>            perf_surf = perf_font.render(perf_text, True, perf_color)<br>            screen.blit(perf_surf, (self.x - perf_surf.get_width()//2, self.y + self.size + 5))<br><br>def split_bubble(bubble, bubbles, frame_count):<br>    if bubble.size &lt; MIN_SPLIT_SIZE:<br>        return<br>        <br>    # Create two smaller bubbles<br>    new_size = bubble.size / 2<br>    <br>    if bubble.in_basket:<br>        # Split while in basket - both new bubbles start in the same basket<br>        bubble1 = Bubble(bubble.x, bubble.y, new_size)<br>        bubble2 = Bubble(bubble.x, bubble.y, new_size)<br>        <br>        if bubble.current_basket:<br>            bubble1.enter_basket(bubble.current_basket)<br>            bubble2.enter_basket(bubble.current_basket)<br>    else:<br>        # Split while moving - new bubbles get opposite directions<br>        angle = random.uniform(0, 2 * math.pi)<br>        <br>        bubble1 = Bubble(bubble.x, bubble.y, new_size)<br>        bubble1.dx = math.cos(angle)<br>        bubble1.dy = math.sin(angle)<br>        bubble1.last_rebalance = frame_count<br>        <br>        bubble2 = Bubble(bubble.x, bubble.y, new_size)<br>        bubble2.dx = math.cos(angle + math.pi)<br>        bubble2.dy = math.sin(angle + math.pi)<br>        bubble2.last_rebalance = frame_count<br>    <br>    bubbles.append(bubble1)<br>    bubbles.append(bubble2)<br>    bubbles.remove(bubble)<br><br>def main():<br>    clock = pygame.time.Clock()<br>    frame_count = 0<br>    <br>    # Create baskets<br>    baskets = [Basket(i) for i in range(M)]<br>    <br>    # Create bubbles<br>    bubbles = [Bubble() for _ in range(N)]<br>    <br>    # Statistics<br>    total_value = sum(bubble.size for bubble in bubbles)<br>    peak_value = total_value<br>    <br>    running = True<br>    while running:<br>        frame_count += 1<br>        <br>        for event in pygame.event.get():<br>            if event.type == pygame.QUIT:<br>                running = False<br>            elif event.type == pygame.KEYDOWN:<br>                if event.key == pygame.K_ESCAPE:<br>                    running = False<br>                elif event.key == pygame.K_r:  # Reset simulation<br>                    baskets = [Basket(i) for i in range(M)]<br>                    bubbles = [Bubble() for _ in range(N)]<br>                    frame_count = 0<br>                    total_value = sum(bubble.size for bubble in bubbles)<br>                    peak_value = total_value<br>                elif event.key == pygame.K_a:  # Add a bubble<br>                    bubbles.append(Bubble())<br>                elif event.key == pygame.K_s:  # Add a basket<br>                    baskets.append(Basket(len(baskets)))<br>        <br>        # Clear screen<br>        screen.fill(BACKGROUND)<br>        <br>        # Update and draw baskets<br>        for basket in baskets:<br>            basket.update()<br>            basket.draw()<br>        <br>        # Update and draw bubbles<br>        current_total = 0<br>        for bubble in bubbles[:]:  # Use a copy for iteration<br>            bubble.update(baskets, frame_count)<br>            bubble.draw()<br>            current_total += bubble.size<br>            <br>            # Randomly split bubbles<br>            if random.random() &lt; SPLIT_PROBABILITY:<br>                split_bubble(bubble, bubbles, frame_count)<br>        <br>        # Update statistics<br>        total_value = current_total<br>        peak_value = max(peak_value, total_value)<br>        <br>        # Draw stats panel<br>        font = pygame.font.SysFont(&#39;Arial&#39;, 16)<br>        stats_bg = pygame.Surface((400, 120), pygame.SRCALPHA)<br>        stats_bg.fill((0, 0, 0, 180))<br>        screen.blit(stats_bg, (10, 10))<br>        <br>        active_bubbles = len([b for b in bubbles if not b.in_basket])<br>        invested_bubbles = len([b for b in bubbles if b.in_basket])<br>        <br>        stats_lines = [<br>            f&quot;Total Portfolio Value: ${total_value:.2f}&quot;,<br>            f&quot;Peak Value: ${peak_value:.2f}&quot;,<br>            f&quot;Bubbles: {active_bubbles} active, {invested_bubbles} invested&quot;,<br>            f&quot;Baskets: {len(baskets)}&quot;,<br>            f&quot;Performance: {((total_value - (N * (MIN_BUBBLE_SIZE + MAX_BUBBLE_SIZE)/2)) / (N * (MIN_BUBBLE_SIZE + MAX_BUBBLE_SIZE)/2) * 100):.1f}%&quot;<br>        ]<br>        <br>        for i, line in enumerate(stats_lines):<br>            text_surf = font.render(line, True, TEXT_COLOR)<br>            screen.blit(text_surf, (20, 15 + i * 22))<br>        <br>        # Draw instructions<br>        instructions = [<br>            &quot;R: Reset simulation&quot;,<br>            &quot;A: Add bubble&quot;, <br>            &quot;S: Add basket&quot;,<br>            &quot;ESC: Quit&quot;<br>        ]<br>        <br>        for i, instruction in enumerate(instructions):<br>            inst_surf = font.render(instruction, True, (180, 180, 180))<br>            screen.blit(inst_surf, (WIDTH - inst_surf.get_width() - 10, 15 + i * 22))<br>        <br>        pygame.display.flip()<br>        clock.tick(60)<br>    <br>    pygame.quit()<br>    sys.exit()<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>Este es el primero prototipo que podemos analizar más.</p><p>V2- HHI de la cuota del mercado + HHI de los origines diferentes de los ingresos + HHI de los salarios</p><pre>&quot;&quot;&quot;<br>W-DAHHI+ = z(DAHHI) + z(Salary HHI)<br>=====================================<br>Additive model with z-score normalization.<br><br>Compares multiplicative vs additive formulations<br>on the same historical dataset.<br>&quot;&quot;&quot;<br><br>import numpy as np<br>import pandas as pd<br>from scipy import stats<br>from sklearn.linear_model import LogisticRegression<br>from sklearn.metrics import roc_auc_score<br>import warnings<br>warnings.filterwarnings(&#39;ignore&#39;)<br><br><br># ============================================================<br># SECTION 1: DATASET (same as before)<br># ============================================================<br><br>def build_dataset():<br>    return {<br>        1965: [<br>            {&#39;name&#39;: &#39;AT&amp;T&#39;,        &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.45,0.25,0.15,0.10,0.05], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;GM&#39;,          &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.50,0.20,0.15,0.10,0.05], &#39;w&#39;: 0.050},<br>            {&#39;name&#39;: &#39;Standard Oil&#39;,&#39;ms&#39;: 0.022, &#39;seg&#39;: [0.55,0.20,0.15,0.10], &#39;w&#39;: 0.040},<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.60,0.20,0.12,0.08], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;GE&#39;,          &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.048},<br>            {&#39;name&#39;: &#39;Ford&#39;,        &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.052},<br>            {&#39;name&#39;: &#39;Kodak&#39;,       &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.40,0.30,0.20,0.10], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;Sears&#39;,       &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.55,0.25,0.15,0.05], &#39;w&#39;: 0.042},<br>            {&#39;name&#39;: &#39;US Steel&#39;,    &#39;ms&#39;: 0.008, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.038},<br>            {&#39;name&#39;: &#39;Gulf Oil&#39;,    &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.043},<br>        ],<br>        1972: [<br>            {&#39;name&#39;: &#39;IBM&#39;,          &#39;ms&#39;: 0.035, &#39;seg&#39;: [0.55,0.25,0.12,0.08], &#39;w&#39;: 0.070},<br>            {&#39;name&#39;: &#39;Eastman Kodak&#39;, &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.50,0.30,0.15,0.05], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;General Electric&#39;, &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;Sears&#39;,         &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.55,0.25,0.15,0.05], &#39;w&#39;: 0.058},<br>            {&#39;name&#39;: &#39;Xerox&#39;,         &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;3M&#39;,            &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.35,0.25,0.20,0.12,0.08], &#39;w&#39;: 0.062},<br>            {&#39;name&#39;: &#39;Procter &amp; Gamble&#39;, &#39;ms&#39;: 0.014, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.052},<br>            {&#39;name&#39;: &#39;Coca-Cola&#39;,     &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.60,0.20,0.12,0.08], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;Avon Products&#39;, &#39;ms&#39;: 0.008, &#39;seg&#39;: [0.80,0.15,0.05], &#39;w&#39;: 0.080},<br>            {&#39;name&#39;: &#39;Johnson &amp; Johnson&#39;, &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.35,0.25,0.20,0.12,0.08], &#39;w&#39;: 0.068},<br>        ],<br>        1980: [<br>            {&#39;name&#39;: &#39;Exxon&#39;,       &#39;ms&#39;: 0.032, &#39;seg&#39;: [0.70,0.15,0.10,0.05], &#39;w&#39;: 0.120},<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.55,0.25,0.12,0.08], &#39;w&#39;: 0.105},<br>            {&#39;name&#39;: &#39;AT&amp;T&#39;,        &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.50,0.25,0.15,0.10], &#39;w&#39;: 0.095},<br>            {&#39;name&#39;: &#39;GM&#39;,          &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.55,0.20,0.15,0.10], &#39;w&#39;: 0.110},<br>            {&#39;name&#39;: &#39;Mobil&#39;,       &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.65,0.20,0.10,0.05], &#39;w&#39;: 0.125},<br>            {&#39;name&#39;: &#39;Std Oil CA&#39;,  &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.118},<br>            {&#39;name&#39;: &#39;Ford&#39;,        &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.115},<br>            {&#39;name&#39;: &#39;GE&#39;,          &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.35,0.25,0.20,0.12,0.08], &#39;w&#39;: 0.100},<br>            {&#39;name&#39;: &#39;Gulf Oil&#39;,    &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.122},<br>            {&#39;name&#39;: &#39;DuPont&#39;,      &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.40,0.30,0.20,0.10], &#39;w&#39;: 0.098},<br>        ],<br>        1987: [<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.030, &#39;seg&#39;: [0.50,0.25,0.15,0.10], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;Exxon&#39;,       &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.70,0.15,0.10,0.05], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;General Electric&#39;, &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.058},<br>            {&#39;name&#39;: &#39;AT&amp;T&#39;,        &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.45,0.25,0.15,0.15], &#39;w&#39;: 0.050},<br>            {&#39;name&#39;: &#39;General Motors&#39;, &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.55,0.20,0.15,0.10], &#39;w&#39;: 0.052},<br>            {&#39;name&#39;: &#39;Ford&#39;,        &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;Royal Dutch Shell&#39;, &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.65,0.20,0.10,0.05], &#39;w&#39;: 0.048},<br>            {&#39;name&#39;: &#39;Wal-Mart&#39;,    &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.085},<br>            {&#39;name&#39;: &#39;Eastman Kodak&#39;, &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.50,0.30,0.15,0.05], &#39;w&#39;: 0.042},<br>            {&#39;name&#39;: &#39;DuPont&#39;,      &#39;ms&#39;: 0.008, &#39;seg&#39;: [0.40,0.30,0.20,0.10], &#39;w&#39;: 0.055},<br>        ],<br>        1989: [<br>            {&#39;name&#39;: &#39;Nippon Telegraph &amp; Telephone&#39;, &#39;ms&#39;: 0.040, &#39;seg&#39;: [0.70,0.15,0.10,0.05], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;Industrial Bank of Japan&#39;, &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: 0.070},<br>            {&#39;name&#39;: &#39;Sumitomo Bank&#39;, &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.075},<br>            {&#39;name&#39;: &#39;Fuji Bank&#39;,   &#39;ms&#39;: 0.024, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: 0.072},<br>            {&#39;name&#39;: &#39;Dai-Ichi Kangyo Bank&#39;, &#39;ms&#39;: 0.023, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.068},<br>            {&#39;name&#39;: &#39;Mitsubishi Bank&#39;, &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: 0.078},<br>            {&#39;name&#39;: &#39;Tokyo Electric Power&#39;, &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.60,0.20,0.12,0.08], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;Sanwa Bank&#39;,  &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.38,0.27,0.20,0.15], &#39;w&#39;: 0.070},<br>            {&#39;name&#39;: &#39;Toyota Motor&#39;,&#39;ms&#39;: 0.018, &#39;seg&#39;: [0.65,0.15,0.12,0.08], &#39;w&#39;: 0.062},<br>            {&#39;name&#39;: &#39;Nomura Securities&#39;, &#39;ms&#39;: 0.016, &#39;seg&#39;: [0.50,0.25,0.15,0.10], &#39;w&#39;: 0.110},<br>        ],<br>        1990: [<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.029, &#39;seg&#39;: [0.45,0.25,0.18,0.12], &#39;w&#39;: 0.035},<br>            {&#39;name&#39;: &#39;Exxon&#39;,       &#39;ms&#39;: 0.029, &#39;seg&#39;: [0.68,0.15,0.10,0.07], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;General Electric&#39;, &#39;ms&#39;: 0.023, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.048},<br>            {&#39;name&#39;: &#39;Philip Morris&#39;, &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.55,0.20,0.15,0.10], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;Royal Dutch Shell&#39;, &#39;ms&#39;: 0.019, &#39;seg&#39;: [0.65,0.18,0.10,0.07], &#39;w&#39;: 0.058},<br>            {&#39;name&#39;: &#39;AT&amp;T&#39;,        &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.42,0.28,0.18,0.12], &#39;w&#39;: 0.042},<br>            {&#39;name&#39;: &#39;Wal-Mart&#39;,    &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;Coca-Cola&#39;,   &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.60,0.20,0.12,0.08], &#39;w&#39;: 0.062},<br>            {&#39;name&#39;: &#39;Merck&#39;,       &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.45,0.25,0.18,0.12], &#39;w&#39;: 0.072},<br>            {&#39;name&#39;: &#39;Procter &amp; Gamble&#39;, &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.38,0.27,0.20,0.15], &#39;w&#39;: 0.052},<br>        ],<br>        1999: [<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.120},<br>            {&#39;name&#39;: &#39;Cisco&#39;,       &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.150},<br>            {&#39;name&#39;: &#39;Intel&#39;,       &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.65,0.25,0.10], &#39;w&#39;: 0.100},<br>            {&#39;name&#39;: &#39;Exxon Mobil&#39;, &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.70,0.15,0.10,0.05], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;GE&#39;,          &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;Lucent&#39;,      &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.75,0.15,0.10], &#39;w&#39;: 0.130},<br>            {&#39;name&#39;: &#39;Oracle&#39;,      &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.110},<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.45,0.25,0.18,0.12], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;Yahoo&#39;,       &#39;ms&#39;: 0.005, &#39;seg&#39;: [0.85,0.10,0.05], &#39;w&#39;: 0.180},<br>            {&#39;name&#39;: &#39;Amazon&#39;,      &#39;ms&#39;: 0.004, &#39;seg&#39;: [0.90,0.05,0.05], &#39;w&#39;: 0.160},<br>        ],<br>        2000: [<br>            {&#39;name&#39;: &#39;General Electric&#39;, &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.058},<br>            {&#39;name&#39;: &#39;Exxon Mobil&#39;, &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.70,0.15,0.10,0.05], &#39;w&#39;: 0.048},<br>            {&#39;name&#39;: &#39;Pfizer&#39;,      &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.55,0.25,0.12,0.08], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;Cisco&#39;,       &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.140},<br>            {&#39;name&#39;: &#39;Citigroup&#39;,   &#39;ms&#39;: 0.016, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.55,0.25,0.15,0.05], &#39;w&#39;: 0.110},<br>            {&#39;name&#39;: &#39;Wal-Mart&#39;,    &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.075},<br>            {&#39;name&#39;: &#39;AIG&#39;,         &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: 0.085},<br>            {&#39;name&#39;: &#39;Intel&#39;,       &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.65,0.25,0.10], &#39;w&#39;: 0.095},<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.014, &#39;seg&#39;: [0.45,0.25,0.18,0.12], &#39;w&#39;: 0.050},<br>        ],<br>        2006: [<br>            {&#39;name&#39;: &#39;Exxon Mobil&#39;, &#39;ms&#39;: 0.030, &#39;seg&#39;: [0.72,0.15,0.08,0.05], &#39;w&#39;: 0.080},<br>            {&#39;name&#39;: &#39;Citigroup&#39;,   &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.095},<br>            {&#39;name&#39;: &#39;BofA&#39;,        &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.45,0.25,0.18,0.12], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;GE&#39;,          &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.070},<br>            {&#39;name&#39;: &#39;Wal-Mart&#39;,    &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;JPMorgan&#39;,    &#39;ms&#39;: 0.016, &#39;seg&#39;: [0.40,0.30,0.18,0.12], &#39;w&#39;: 0.100},<br>            {&#39;name&#39;: &#39;AIG&#39;,         &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: 0.088},<br>            {&#39;name&#39;: &#39;Goldman&#39;,     &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.45,0.25,0.20,0.10], &#39;w&#39;: 0.150},<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.022, &#39;seg&#39;: [0.55,0.25,0.15,0.05], &#39;w&#39;: 0.072},<br>            {&#39;name&#39;: &#39;Lehman&#39;,      &#39;ms&#39;: 0.008, &#39;seg&#39;: [0.50,0.30,0.20], &#39;w&#39;: 0.120},<br>        ],<br>        2008: [<br>            {&#39;name&#39;: &#39;Exxon Mobil&#39;, &#39;ms&#39;: 0.032, &#39;seg&#39;: [0.75,0.12,0.08,0.05], &#39;w&#39;: 0.075},<br>            {&#39;name&#39;: &#39;Wal-Mart&#39;,    &#39;ms&#39;: 0.030, &#39;seg&#39;: [0.65,0.20,0.15], &#39;w&#39;: 0.050},<br>            {&#39;name&#39;: &#39;Chevron&#39;,     &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.70,0.18,0.12], &#39;w&#39;: 0.078},<br>            {&#39;name&#39;: &#39;GE&#39;,          &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.28,0.25,0.22,0.15,0.10], &#39;w&#39;: 0.020},<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.50,0.28,0.15,0.07], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;P&amp;G&#39;,         &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;J&amp;J&#39;,         &#39;ms&#39;: 0.014, &#39;seg&#39;: [0.35,0.25,0.20,0.12,0.08], &#39;w&#39;: 0.040},<br>            {&#39;name&#39;: &#39;AT&amp;T&#39;,        &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.40,0.25,0.20,0.15], &#39;w&#39;: 0.038},<br>            {&#39;name&#39;: &#39;IBM&#39;,         &#39;ms&#39;: 0.016, &#39;seg&#39;: [0.40,0.28,0.20,0.12], &#39;w&#39;: 0.035},<br>            {&#39;name&#39;: &#39;Citigroup&#39;,   &#39;ms&#39;: 0.010, &#39;seg&#39;: [0.35,0.30,0.20,0.15], &#39;w&#39;: -0.100},<br>        ],<br>        2021: [<br>            {&#39;name&#39;: &#39;Apple&#39;,       &#39;ms&#39;: 0.045, &#39;seg&#39;: [0.52,0.20,0.12,0.10,0.06], &#39;w&#39;: 0.080},<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.038, &#39;seg&#39;: [0.35,0.28,0.20,0.12,0.05], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;Amazon&#39;,      &#39;ms&#39;: 0.040, &#39;seg&#39;: [0.50,0.22,0.15,0.10,0.03], &#39;w&#39;: 0.120},<br>            {&#39;name&#39;: &#39;Alphabet&#39;,    &#39;ms&#39;: 0.032, &#39;seg&#39;: [0.80,0.12,0.08], &#39;w&#39;: 0.100},<br>            {&#39;name&#39;: &#39;Meta&#39;,        &#39;ms&#39;: 0.025, &#39;seg&#39;: [0.95,0.03,0.02], &#39;w&#39;: 0.095},<br>            {&#39;name&#39;: &#39;Tesla&#39;,       &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.85,0.10,0.05], &#39;w&#39;: 0.150},<br>            {&#39;name&#39;: &#39;Nvidia&#39;,      &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.80,0.15,0.05], &#39;w&#39;: 0.130},<br>            {&#39;name&#39;: &#39;Berkshire&#39;,   &#39;ms&#39;: 0.018, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.055},<br>            {&#39;name&#39;: &#39;JPMorgan&#39;,    &#39;ms&#39;: 0.016, &#39;seg&#39;: [0.35,0.28,0.22,0.15], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;Visa&#39;,        &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.70,0.20,0.10], &#39;w&#39;: 0.070},<br>        ],<br>        2024: [<br>            {&#39;name&#39;: &#39;Apple&#39;,       &#39;ms&#39;: 0.048, &#39;seg&#39;: [0.50,0.22,0.12,0.10,0.06], &#39;w&#39;: 0.045},<br>            {&#39;name&#39;: &#39;Microsoft&#39;,   &#39;ms&#39;: 0.042, &#39;seg&#39;: [0.32,0.30,0.20,0.13,0.05], &#39;w&#39;: 0.060},<br>            {&#39;name&#39;: &#39;Nvidia&#39;,      &#39;ms&#39;: 0.035, &#39;seg&#39;: [0.85,0.10,0.05], &#39;w&#39;: 0.250},<br>            {&#39;name&#39;: &#39;Amazon&#39;,      &#39;ms&#39;: 0.038, &#39;seg&#39;: [0.48,0.24,0.15,0.10,0.03], &#39;w&#39;: 0.070},<br>            {&#39;name&#39;: &#39;Alphabet&#39;,    &#39;ms&#39;: 0.030, &#39;seg&#39;: [0.78,0.14,0.08], &#39;w&#39;: 0.065},<br>            {&#39;name&#39;: &#39;Meta&#39;,        &#39;ms&#39;: 0.028, &#39;seg&#39;: [0.95,0.03,0.02], &#39;w&#39;: 0.080},<br>            {&#39;name&#39;: &#39;Berkshire&#39;,   &#39;ms&#39;: 0.020, &#39;seg&#39;: [0.30,0.25,0.20,0.15,0.10], &#39;w&#39;: 0.050},<br>            {&#39;name&#39;: &#39;Eli Lilly&#39;,   &#39;ms&#39;: 0.015, &#39;seg&#39;: [0.60,0.25,0.15], &#39;w&#39;: 0.090},<br>            {&#39;name&#39;: &#39;Broadcom&#39;,    &#39;ms&#39;: 0.014, &#39;seg&#39;: [0.55,0.25,0.20], &#39;w&#39;: 0.110},<br>            {&#39;name&#39;: &#39;Tesla&#39;,       &#39;ms&#39;: 0.012, &#39;seg&#39;: [0.82,0.12,0.06], &#39;w&#39;: 0.030},<br>        ],<br>    }<br><br><br># ============================================================<br># SECTION 2: CALCULATIONS<br># ============================================================<br><br>def avg_market_hhi(firms):<br>    shares = np.array([f[&#39;ms&#39;] for f in firms])<br>    shares = shares / shares.sum()<br>    return np.mean(shares ** 2)<br><br><br>def avg_revenue_hhi(firms):<br>    hhis = []<br>    for f in firms:<br>        seg = np.array(f[&#39;seg&#39;], dtype=float)<br>        seg = seg / seg.sum()<br>        hhis.append(np.sum(seg ** 2))<br>    return np.mean(hhis)<br><br><br>def calc_dahhi(firms):<br>    return avg_market_hhi(firms) * avg_revenue_hhi(firms)<br><br><br>def salary_hhi(firms):<br>    changes = np.array([abs(f[&#39;ms&#39;] * f[&#39;w&#39;]) for f in firms])<br>    total = changes.sum()<br>    if total == 0:<br>        return 1.0 / len(firms)<br>    shares = changes / total<br>    return np.sum(shares ** 2)<br><br><br>def build_raw_results():<br>    &quot;&quot;&quot;Build raw metrics for all years (before normalization).&quot;&quot;&quot;<br>    data = build_dataset()<br>    bubble_years = {1929, 1972, 1987, 1989, 1999, 2000, 2006, 2007, 2021}<br>    crisis_years = {1929, 1987, 1989, 2000, 2008, 2020}<br>    <br>    rows = []<br>    for year, firms in data.items():<br>        rows.append({<br>            &#39;year&#39;: year,<br>            &#39;dahhi&#39;: calc_dahhi(firms),<br>            &#39;salary_hhi&#39;: salary_hhi(firms),<br>            &#39;is_bubble&#39;: 1 if year in bubble_years else 0,<br>            &#39;is_crisis&#39;: 1 if year in crisis_years else 0,<br>        })<br>    return pd.DataFrame(rows)<br><br><br>def add_composite_metrics(df):<br>    &quot;&quot;&quot;<br>    Add three composite formulations:<br>    1. Multiplicative: DAHHI × Salary HHI<br>    2. Additive (raw): DAHHI + Salary HHI<br>    3. Additive (z-scored): z(DAHHI) + z(Salary HHI)<br>    &quot;&quot;&quot;<br>    # Multiplicative<br>    df[&#39;w_dahhi_mult&#39;] = df[&#39;dahhi&#39;] * df[&#39;salary_hhi&#39;]<br>    <br>    # Additive raw (problematic due to scale mismatch)<br>    df[&#39;w_dahhi_add_raw&#39;] = df[&#39;dahhi&#39;] + df[&#39;salary_hhi&#39;]<br>    <br>    # Additive z-scored (balanced)<br>    df[&#39;dahhi_z&#39;] = stats.zscore(df[&#39;dahhi&#39;])<br>    df[&#39;salary_z&#39;] = stats.zscore(df[&#39;salary_hhi&#39;])<br>    df[&#39;w_dahhi_add_z&#39;] = df[&#39;dahhi_z&#39;] + df[&#39;salary_z&#39;]<br>    <br>    # Weighted additive (equal weights after min-max scaling)<br>    df[&#39;dahhi_mm&#39;] = (df[&#39;dahhi&#39;] - df[&#39;dahhi&#39;].min()) / (df[&#39;dahhi&#39;].max() - df[&#39;dahhi&#39;].min())<br>    df[&#39;salary_mm&#39;] = (df[&#39;salary_hhi&#39;] - df[&#39;salary_hhi&#39;].min()) / (df[&#39;salary_hhi&#39;].max() - df[&#39;salary_hhi&#39;].min())<br>    df[&#39;w_dahhi_add_mm&#39;] = df[&#39;dahhi_mm&#39;] + df[&#39;salary_mm&#39;]<br>    <br>    return df<br><br><br># ============================================================<br># SECTION 3: TESTS<br># ============================================================<br><br>def run_tests(df):<br>    print(&quot;=&quot; * 100)<br>    print(&quot;MULTIPLICATIVE vs ADDITIVE FORMULATIONS&quot;)<br>    print(&quot;=&quot; * 100)<br>    print(df[[&#39;year&#39;, &#39;dahhi&#39;, &#39;salary_hhi&#39;, &#39;w_dahhi_mult&#39;, <br>              &#39;w_dahhi_add_raw&#39;, &#39;w_dahhi_add_z&#39;, &#39;w_dahhi_add_mm&#39;,<br>              &#39;is_bubble&#39;, &#39;is_crisis&#39;]].round(6).to_string(index=False))<br>    print()<br>    <br>    # 预测力比较<br>    print(&quot;-&quot; * 100)<br>    print(&quot;PREDICTIVE POWER COMPARISON (Pearson correlation)&quot;)<br>    print(&quot;-&quot; * 100)<br>    print(f&quot;{&#39;Metric&#39;:&lt;22} {&#39;vs bubble&#39;:&lt;20} {&#39;vs crisis&#39;:&lt;20}&quot;)<br>    print(&quot;-&quot; * 100)<br>    for col in [&#39;dahhi&#39;, &#39;salary_hhi&#39;, &#39;w_dahhi_mult&#39;, <br>                &#39;w_dahhi_add_raw&#39;, &#39;w_dahhi_add_z&#39;, &#39;w_dahhi_add_mm&#39;]:<br>        corr_b, p_b = stats.pearsonr(df[col], df[&#39;is_bubble&#39;])<br>        corr_c, p_c = stats.pearsonr(df[col], df[&#39;is_crisis&#39;])<br>        sig_b = &quot;***&quot; if p_b &lt; 0.01 else &quot;**&quot; if p_b &lt; 0.05 else &quot;*&quot; if p_b &lt; 0.10 else &quot;&quot;<br>        sig_c = &quot;***&quot; if p_c &lt; 0.01 else &quot;**&quot; if p_c &lt; 0.05 else &quot;*&quot; if p_c &lt; 0.10 else &quot;&quot;<br>        print(f&quot;{col:&lt;22} {corr_b:+.4f}{sig_b:&lt;16} {corr_c:+.4f}{sig_c:&lt;16}&quot;)<br>    <br>    # AUC 比较<br>    print()<br>    print(&quot;-&quot; * 100)<br>    print(&quot;LOGISTIC REGRESSION AUC&quot;)<br>    print(&quot;-&quot; * 100)<br>    print(f&quot;{&#39;Metric&#39;:&lt;22} {&#39;AUC bubble&#39;:&lt;15} {&#39;AUC crisis&#39;:&lt;15}&quot;)<br>    print(&quot;-&quot; * 100)<br>    for col in [&#39;dahhi&#39;, &#39;w_dahhi_mult&#39;, &#39;w_dahhi_add_raw&#39;, <br>                &#39;w_dahhi_add_z&#39;, &#39;w_dahhi_add_mm&#39;]:<br>        X = df[[col]].values<br>        auc_b = auc_c = np.nan<br>        for target, store in [(&#39;is_bubble&#39;, &#39;b&#39;), (&#39;is_crisis&#39;, &#39;c&#39;)]:<br>            y = df[target].values<br>            if len(np.unique(y)) &gt; 1:<br>                model = LogisticRegression()<br>                model.fit(X, y)<br>                y_prob = model.predict_proba(X)[:, 1]<br>                auc = roc_auc_score(y, y_prob)<br>                if store == &#39;b&#39;: auc_b = auc<br>                else: auc_c = auc<br>        print(f&quot;{col:&lt;22} {auc_b:&lt;15.4f} {auc_c:&lt;15.4f}&quot;)<br>    <br>    # 可视化<br>    print()<br>    print(&quot;-&quot; * 100)<br>    print(&quot;VISUAL COMPARISON (normalized to max)&quot;)<br>    print(&quot;-&quot; * 100)<br>    <br>    for col, label in [<br>        (&#39;w_dahhi_mult&#39;, &#39;Multiplicative&#39;),<br>        (&#39;w_dahhi_add_raw&#39;, &#39;Additive (raw)&#39;),<br>        (&#39;w_dahhi_add_z&#39;, &#39;Additive (z-scored)&#39;),<br>        (&#39;w_dahhi_add_mm&#39;, &#39;Additive (min-max)&#39;),<br>    ]:<br>        print(f&quot;\n{label}:&quot;)<br>        norm = df[col] / df[col].max() if df[col].max() &gt; 0 else df[col]<br>        for i, row in df.iterrows():<br>            bar = &quot;█&quot; * int(norm.iloc[i] * 40)<br>            flags = &quot;&quot;<br>            if row[&#39;is_bubble&#39;]: flags += &quot; ⚠️&quot;<br>            if row[&#39;is_crisis&#39;]: flags += &quot; 💥&quot;<br>            print(f&quot;  {int(row[&#39;year&#39;])}: {row[col]:+.6f} {bar}{flags}&quot;)<br>    <br>    # 排名对比<br>    print()<br>    print(&quot;-&quot; * 100)<br>    print(&quot;RANKING COMPARISON (top 5 highest values)&quot;)<br>    print(&quot;-&quot; * 100)<br>    for col in [&#39;dahhi&#39;, &#39;w_dahhi_mult&#39;, &#39;w_dahhi_add_raw&#39;, <br>                &#39;w_dahhi_add_z&#39;, &#39;w_dahhi_add_mm&#39;]:<br>        top5 = df.nlargest(5, col)[[&#39;year&#39;, col]].values<br>        top5_str = &quot;, &quot;.join([f&quot;{int(y)}: {v:.4f}&quot; for y, v in top5])<br>        print(f&quot;{col:&lt;22}: {top5_str}&quot;)<br><br><br># ============================================================<br># MAIN<br># ============================================================<br><br>if __name__ == &quot;__main__&quot;:<br>    df = build_raw_results()<br>    df = add_composite_metrics(df)<br>    run_tests(df)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50abf673d6bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Función Zeta]]></title>
            <link>https://medium.com/@sumit.tripathi/zeta-funci%C3%B3n-f5f9cb4fde47?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5f9cb4fde47</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 05:54:52 GMT</pubDate>
            <atom:updated>2026-11-12T07:28:28.252Z</atom:updated>
            <content:encoded><![CDATA[<h4>Buscando nueva perspectiva para ver el problema</h4><p>Era un estudiante cuando he escuchado sobre la zeta función. No me entendí mucho pero siempre sentí enamorado que este problema no hubo soluciones todavía.</p><p>En este prototipo, quiero buscar perspectivas nuevas para entender mejor el problema.</p><h4>1.Las series de la suma de potencias orden n = su valor de función zeta</h4><pre>n | Finite Sum (1^n+...+N^n) | zeta(-n)<br>--|--------------------------|----------<br>0 | N | -1/2<br>1 | N(N+1)/2 | -1/12<br>2 | N(N+1)(2N+1)/6 | 0<br>3 | N^2(N+1)^2/4 | 1/120<br>4 | N(N+1)(2N+1)(3N^2+3N-1)/30 | 0<br>5 | N^2(N+1)^2(2N^2+2N-1)/12 | -1/252<br>6 | N(N+1)(2N+1)(3N^4+6N^3-3N+1)/42 | 0<br>7 | N^2(N+1)^2(3N^4+6N^3-N^2-4N+2)/24 | 1/240<br>8 | N(N+1)(2N+1)(5N^6+15N^5+5N^4-15N^3-N^2+9N-3)/90 | 0<br>9 | N^2(N+1)^2(N^2+N-1)(3N^4+6N^3-3N+1)/20 | -1/132<br>10 | N(N+1)(2N+1)(3N^8+12N^7+6N^6-24N^5-9N^4+36N^3+3N^2-18N+5)/66 | 0</pre><p>Cuando calculemos la N en cada ecuación, la simetría siempre está en -0.5.</p><p>Interesante!!</p><p>Además podemos usar el método de Euler para expandir la serie usando el product de las series como…</p><p>ej.</p><p>1² + 2² +3² +…. = n(n+1)/2</p><p>(1² + 2² + 4² + …)(1+ 3² + 9² + …)(1² + 5² + 25² +…)(…)… = n(n+1)/2</p><p>(1² + 2² + 2⁴+ 2⁶ +…)(1² + 3² + 3⁴ + 3⁶ +…)(1² + 5² + 5⁴ + 5⁶ +…)(…) = n(n+1)/2</p><p>[(2^2n -1)/(2² -1)] [(3^2n -1)/(3² -1)] [(5^2n -1)/(5² -1)] ….= n(n+1)/2</p><p>[2^2n-1/(3)] [(3^2n -1)/(8)] [(5^2n -1)/(24)] … = n(n+1)/2</p><p>zeta(-s) = Productos[(p^nm -1)/(p^m -1)] cuando m = s</p><p>Por eso cada equación con 2n+1, el valor de zeta siempre es 0. Porque necesita tener simetría en -1/2</p><p>Además, si dibujamos la función, más el orden (números pares), más se ve como la función de sine! Entonces la pregunta sea, podemos usar la función de sine para aproximar la zeta función? y cuál sería su amplitúd (porque amplia mucho por cada orden de n) o la frecuencia y dónde está el punto de simetría (en el -0.5 o +0.5 ????)</p><h4>2. GCD del divisor de la serie de suma por zeta(-número par) y el valor de zeta =/= 0</h4><p>Zeta(-2) = -1/12 — GCD(-1/12, 1/2) = 1/12</p><p>etc.</p><h4>3. -0.5 es la línea o la fronterra de interno y externo ?</h4><p>Suena un poco raro jaja, pero cuando vi los patrones, me parece que 0–1 y 1 hasta infinidad son muy parecidos. Por eso, la suma de serie y el valor de zeta hay relaciones, aunque no tiene razón cuando lo comparamos directamente. Es que no puedo construir el model alrededor este hipótesis todavía.</p><p>???</p><h4>4.Las resultas reales y complejos son ven como un círculo?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*4DHaX3GFeV0KUJNIRmC-7Q.png" /><figcaption>El dibujo de las repuestas de la serie de la sume del orden 50 desde Wolframalpha</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*uXbUKWaFv3Rag6q5lQV0wQ.png" /><figcaption>Cuando dibujamos por el order de 100 = zeta(-99)</figcaption></figure><p>su simetría también no está en 0 pero en 0.5!</p><p>La amplitud es alrededor de sqrt(N).</p><p>Tal vez esta forma puede avisarnos por qué hay pi² en el valor de zeta. Se ve como un tipo de círculo complejo o la combinación de hípoerbola?</p><p>Además podemos calcular la área y analizar sus relaciones con zeta también.</p><h4>5. La simetría/fractal de nivel alto a nivel baja</h4><p>Y si la forma del lado izquierda es la forma grande o más alta o un fractal que la forma en la derecha…??</p><p>Tal vez el punto de 1/2 funciona como el conectador entre 0 y infinidad, pero no es tan directo como lo vemos, pero hay reglas como en el Mobiüs??</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*V6nnIKAhEDMytSsA4k0qXQ.png" /></figure><pre>import numpy as np, matplotlib.pyplot as plt<br>from mpmath import zeta, mp<br><br># --- Real plot: zeta(x) for x in [-2, 2], skipping the pole at 1 ---<br>x = np.linspace(-1.99, 0.99, 800)<br>y = [float(zeta(mp.mpf(float(xi)))) for xi in x]<br>plt.figure(figsize=(8,5))<br>plt.plot(x, y, &#39;b-&#39;, lw=2)<br>plt.axhline(0, color=&#39;k&#39;, lw=0.5); plt.axvline(0, color=&#39;k&#39;, lw=0.5)<br>plt.axvline(1, color=&#39;r&#39;, ls=&#39;--&#39;, label=&#39;pole at s=1&#39;)<br>plt.scatter([-2,0], [0,-0.5], color=&#39;green&#39;, zorder=5)<br>plt.annotate(&#39;trivial zero\ns=-2&#39;, (-2,0), textcoords=&quot;offset points&quot;, xytext=(10,20))<br>plt.annotate(&#39;ζ(0)=-1/2&#39;, (0,-0.5), textcoords=&quot;offset points&quot;, xytext=(15,-25))<br>plt.title(&#39;Riemann ζ(s) on the real axis, s ∈ [-2, 2]&#39;)<br>plt.xlabel(&#39;s&#39;); plt.ylabel(&#39;ζ(s)&#39;); plt.ylim(-6,6); plt.legend(); plt.grid(alpha=.3)<br>plt.tight_layout(); plt.savefig(&#39;zeta_real.png&#39;, dpi=150); plt.show()<br><br># --- Complex plot: |ζ(s)| over the square [-2,2] x [-2,2] ---<br>re = np.linspace(-2, 2, 400); im = np.linspace(-2, 2, 400)<br>R, I = np.meshgrid(re, im)<br>Z = np.abs(np.array([[complex(zeta(mp.mpc(r, i))) for r in re] for i in im], dtype=complex))<br>Z = np.clip(Z, 0, 6)  # clip the pole so the rest is visible<br>plt.figure(figsize=(7,7))<br>plt.pcolormesh(re, im, Z, cmap=&#39;viridis&#39;, shading=&#39;auto&#39;)<br>plt.contour(re, im, Z, levels=[0.5,1,2,3,5], colors=&#39;w&#39;, linewidths=.6)<br>plt.axvline(0.5, color=&#39;magenta&#39;, ls=&#39;--&#39;, lw=1, label=&#39;critical line Re(s)=1/2&#39;)<br>plt.scatter([-2], [0], color=&#39;red&#39;, s=60, zorder=5, label=&#39;trivial zero s=-2&#39;)<br>plt.scatter([1], [0], color=&#39;orange&#39;, s=80, marker=&#39;X&#39;, zorder=5, label=&#39;pole s=1&#39;)<br>plt.title(&#39;|ζ(s)| on the complex square [-2,2]×[-2,2]&#39;)<br>plt.xlabel(&#39;Re(s)&#39;); plt.ylabel(&#39;Im(s)&#39;); plt.legend(loc=&#39;upper left&#39;)<br>plt.colorbar(label=&#39;|ζ(s)| (clipped at 6)&#39;)<br>plt.tight_layout(); plt.savefig(&#39;zeta_complex.png&#39;, dpi=150); plt.show()</pre><h4>6. Esta función como los acordes música</h4><p>La suma en este caso es los acorde. Y después cada parte de la simetría podria avisarnos que es como las octavas diferentes y tal vez y octvas más altas o bajas que no sabemos aún?</p><p>Entonces en mi mente: 1+1+1+1+1+1+1+… = -1/2</p><p>Me parece que es la nota en la octava alta (o baja? porque no me entiendo bien el ‘— ’ en el valor)??</p><pre>import numpy as np<br>import mpmath as mp<br><br>mp.mp.dps = 30<br>NOTE_NAMES = [&#39;C&#39;,&#39;C#&#39;,&#39;D&#39;,&#39;D#&#39;,&#39;E&#39;,&#39;F&#39;,&#39;F#&#39;,&#39;G&#39;,&#39;G#&#39;,&#39;A&#39;,&#39;A#&#39;,&#39;B&#39;]<br><br><br># ------------------------------------------------------------<br># number  -&gt;  (note, octave, frequency)<br># ------------------------------------------------------------<br>def value_to_note(value, base_freq=261.6256, base_octave=4, chroma=12,<br>                  eps=1e-12):<br>    try:<br>        if isinstance(value, (complex, mp.mpc)) or np.iscomplexobj(value):<br>            value = abs(complex(value))<br>        value = float(np.real(value))<br>    except (TypeError, ValueError, OverflowError):<br>        return (&quot;rest&quot;, None, 0.0)<br><br>    if not np.isfinite(value) or abs(value) &lt; eps:<br>        return (&quot;rest&quot;, None, 0.0)<br><br>    mag = min(abs(value), 1e12)<br><br>    log_ratio     = np.log2(mag)<br>    octave_offset = int(np.floor(log_ratio))<br>    frac          = log_ratio - octave_offset<br>    semis         = int(round(frac * chroma))<br>    if semis == chroma:<br>        semis = 0<br>        octave_offset += 1<br><br>    note   = NOTE_NAMES[semis % chroma]<br>    octave = base_octave + octave_offset<br>    freq   = base_freq * (2 ** (semis / chroma)) * (2 ** octave_offset)<br>    return (note, octave, freq)<br><br><br># ------------------------------------------------------------<br># partial sum  sum_{n=1}^{N} 1/n^s<br># ------------------------------------------------------------<br>def zeta_partial_sum(s, N):<br>    sc = complex(s) if isinstance(s, complex) else float(s)<br>    if isinstance(sc, complex):<br>        return sum(1.0 / (complex(n) ** sc) for n in range(1, N + 1))<br>    return sum(1.0 / (n ** sc) for n in range(1, N + 1))<br><br><br># ------------------------------------------------------------<br># cumulative chord: one note per running partial sum<br># ------------------------------------------------------------<br>def zeta_partial_chord(s, N, base_freq=261.6256):<br>    is_complex = isinstance(s, complex) or np.iscomplexobj(np.asarray(s))<br>    running = 0j if is_complex else 0.0<br>    chord = []<br>    for n in range(1, N + 1):<br>        running += 1.0 / ((complex(n) ** s) if is_complex else (n ** s))<br>        note, octv, freq = value_to_note(running, base_freq)<br>        chord.append({&#39;n&#39;: n, &#39;partial&#39;: running,<br>                      &#39;note&#39;: note, &#39;octave&#39;: octv, &#39;freq&#39;: freq})<br>    return chord<br><br><br># ------------------------------------------------------------<br># infinite value via analytic continuation<br># ------------------------------------------------------------<br>def zeta_infinite(s):<br>    if isinstance(s, (int, float, np.integer, np.floating)) and float(s) == 1.0:<br>        return None                                     # pole<br>    try:<br>        z = mp.zeta(s)<br>    except Exception:<br>        return None<br>    if mp.isinf(z) or mp.isnan(z):<br>        return None<br>    return complex(z)<br><br><br># ------------------------------------------------------------<br># printer: note for each zeta partial sum  +  infinite limit<br># ------------------------------------------------------------<br>def show_zeta_notes(s, N):<br>    print(f&quot;\n{&#39;=&#39;*80}&quot;)<br>    print(f&quot;NOTES FOR ζ_{N}({s})   —   one note per running partial sum&quot;)<br>    print(f&quot;{&#39;=&#39;*80}&quot;)<br>    print(f&quot;{&#39;n&#39;:&gt;3} {&#39;term 1/n^s&#39;:&gt;18} {&#39;running ζ_n(s)&#39;:&gt;26} &quot;<br>          f&quot;{&#39;note&#39;:&gt;6} {&#39;freq (Hz)&#39;:&gt;12}&quot;)<br>    print(&quot;-&quot; * 80)<br><br>    chord = zeta_partial_chord(s, N)<br>    for r in chord:<br>        p = r[&#39;partial&#39;]<br>        term = 1.0 / ((complex(r[&#39;n&#39;]) ** s) if isinstance(s, complex)<br>                      else (r[&#39;n&#39;] ** s))<br>        pstr = (f&quot;{p.real:+.8f}{p.imag:+.4f}j&quot;<br>                if isinstance(p, complex) else f&quot;{p:.12f}&quot;)<br>        tstr = (f&quot;{term.real:+.6f}{term.imag:+.4f}j&quot;<br>                if isinstance(term, complex) else f&quot;{term:+.10f}&quot;)<br>        nstr = f&quot;{r[&#39;note&#39;]}{r[&#39;octave&#39;]}&quot; if r[&#39;note&#39;] != &#39;rest&#39; else &#39;rest&#39;<br>        print(f&quot;{r[&#39;n&#39;]:&gt;3} {tstr:&gt;18} {pstr:&gt;26} {nstr:&gt;6} {r[&#39;freq&#39;]:&gt;12.3f}&quot;)<br><br>    # ---- infinite value ----<br>    inf = zeta_infinite(s)<br>    print(&quot;-&quot; * 80)<br>    if inf is None:<br>        print(f&quot;{&#39;∞&#39;:&gt;3} {&#39;—&#39;:&gt;18} {&#39;POLE / undefined&#39;:&gt;26} &quot;<br>              f&quot;{&#39;rest&#39;:&gt;6} {0.0:&gt;12.3f}&quot;)<br>    else:<br>        istr = (f&quot;{inf.real:+.12f}{inf.imag:+.6f}j&quot;<br>                if inf.imag != 0 else f&quot;{inf.real:+.12f}&quot;)<br>        note, octv, freq = value_to_note(inf)<br>        nstr = f&quot;{note}{octv}&quot; if note != &#39;rest&#39; else &#39;rest&#39;<br>        print(f&quot;{&#39;∞&#39;:&gt;3} {&#39;—&#39;:&gt;18} {istr:&gt;26} {nstr:&gt;6} {freq:&gt;12.3f}&quot;)<br><br>        if not (isinstance(s, complex) or np.iscomplexobj(np.asarray(s))) and s &lt;= 1:<br>            print(f&quot;\n  [!] s &lt;= 1 → partial sums diverge. The &#39;∞&#39; row is&quot;)<br>            print(f&quot;      ζ({s}) by analytic continuation (mpmath), not the limit&quot;)<br>            print(f&quot;      of the running partial sums above.&quot;)<br>    print()<br><br><br># ------------------------------------------------------------<br># quick summary: infinite-limit note for a range of s<br># ------------------------------------------------------------<br>def show_zeta_summary(s_list):<br>    print(f&quot;\n{&#39;=&#39;*80}&quot;)<br>    print(&quot;SUMMARY: note for ζ(s)  (infinite sum / analytic continuation)&quot;)<br>    print(f&quot;{&#39;=&#39;*80}&quot;)<br>    print(f&quot;{&#39;s&#39;:&gt;5} {&#39;ζ(s)&#39;:&gt;22} {&#39;|ζ(s)|&#39;:&gt;14} {&#39;note&#39;:&gt;6} {&#39;freq (Hz)&#39;:&gt;12}&quot;)<br>    print(&quot;-&quot; * 80)<br>    for s in s_list:<br>        z = zeta_infinite(s)<br>        if z is None:<br>            print(f&quot;{s:&gt;5} {&#39;POLE&#39;:&gt;22} {&#39;—&#39;:&gt;14} {&#39;rest&#39;:&gt;6} {0.0:&gt;12.3f}&quot;)<br>            continue<br>        zstr = (f&quot;{z.real:+.10f}{z.imag:+.4f}j&quot;<br>                if z.imag != 0 else f&quot;{z.real:+.12f}&quot;)<br>        note, octv, freq = value_to_note(z)<br>        nstr = f&quot;{note}{octv}&quot; if note != &#39;rest&#39; else &#39;rest&#39;<br>        print(f&quot;{s:&gt;5} {zstr:&gt;22} {abs(z):&gt;14.10f} {nstr:&gt;6} {freq:&gt;12.3f}&quot;)<br>    print()<br><br><br># ============================================================<br># DEMO<br># ============================================================<br>if __name__ == &quot;__main__&quot;:<br>    print(&quot;#&quot; * 80)<br>    print(&quot;#  NOTE FOR EACH ZETA SUM&quot;)<br>    print(&quot;#  (mapping: |value| -&gt; log2 -&gt; note,  1 = C4,  0 = REST)&quot;)<br>    print(&quot;#&quot; * 80)<br><br>    # --- term-by-term + infinite for a few key s values ---<br>    show_zeta_notes(s=2.0,  N=16)       # convergent<br><br>    # --- compact summary over s = -10 .. 10 ---<br>    show_zeta_summary(list(range(-10, 11)))<br><br>    # --- sum of squares 1² + 2² + … + 20²  (each term + running sum) ---<br>    print(f&quot;\n{&#39;=&#39;*80}&quot;)<br>    print(&quot;NOTES FOR 1² + 2² + 3² + … + 20²   (running sum Σ k²)&quot;)<br>    print(f&quot;{&#39;=&#39;*80}&quot;)<br>    print(f&quot;{&#39;k&#39;:&gt;3} {&#39;term k²&#39;:&gt;8} {&#39;running Σk²&#39;:&gt;16} &quot;<br>          f&quot;{&#39;note&#39;:&gt;6} {&#39;freq (Hz)&#39;:&gt;12}&quot;)<br>    print(&quot;-&quot; * 80)<br>    running = 0<br>    for k in range(1, 21):<br>        term    = k * k<br>        running += term<br>        note, octv, freq = value_to_note(running)<br>        nstr = f&quot;{note}{octv}&quot; if note != &#39;rest&#39; else &#39;rest&#39;<br>        audible = &quot;&quot; if freq &lt;= 20000 else &quot;  (inaudible)&quot;<br>        print(f&quot;{k:&gt;3} {term:&gt;8} {running:&gt;16} {nstr:&gt;6} &quot;<br>              f&quot;{freq:&gt;12.2f}{audible}&quot;)<br>    print(&quot;-&quot; * 80)<br>    print(f&quot;{&#39;∞&#39;:&gt;3} {&#39;—&#39;:&gt;8} {&#39;ζ(-2) = 0&#39;:&gt;16} {&#39;rest&#39;:&gt;6} {0.0:&gt;12.2f}&quot;)<br>    print()</pre><p>Pero todavía no me entiendo como funciona este método o como se interpretaba esta función en esta manera. Me parece que hay muchos niveles de notas entonces tenemos niveles de infinidad diferentes. Por ejemplo, por qué es posible para analizar la continuación analítica de 1+2+3+4+5… = -1/12 pero el 1+1/2+1/3+1/4+1/5+… es un pole? y qué significa en el contexto de música? que todas las notas en la serie puede crear el sonido resonancia sin fin???? no lo sé.</p><p>Además -1/12 o los valores negativos es tal vez relacionado a la fase diferente no sé como pero si usamos, log2(C4/C3) = 2, etc. siempre tiene valor positivo. Si tuviera valor negativo ln(-1), sería i*pi. El pi aquí puede relacionado a las fases?</p><h4>7. El valor de zeta como la distancia de los espirales</h4><p>Receintemente he visto el video de 3Blue1Brown y su visualización de la función. Me gusta mucho la animación cuando ha cambiado desde número real a número complejo. Se cambia de una línea a un espiral. Es maravilloso. Entonces, creo que si dibujamos los espirales por cada combinación en la forma de n+in o sqrt(n) + isqrt(n) hasta infinidad. Me parece que podríamos calcular la tendencía de cada valor de zeta a través de la distancia de los espirales. Mi hipótesis es que los valores impares de zeta quizás en la forma de pi también pero en unas formas únicas.</p><h4>8. Zeta como la suma de frecuencia (parecido a #6)</h4><p>12/11/26: Si vemos las series como las notas y añadaba las frecuencias para buscar su forma, podríamos ver la relación mejor.</p><p>La área de la onda puede darnos una pista sobre la función zeta?</p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br>from fractions import Fraction<br>import re<br>from math import pi<br><br><br># ---------------------------------------------------------------------------<br># Riemann zeta value (reference)<br># ---------------------------------------------------------------------------<br>def riemann_zeta(s, n=500):<br>    if s == 1:<br>        return float(&quot;inf&quot;)<br>    eta = sum(((-1) ** (k - 1)) / (k ** s) for k in range(1, n))<br>    z = eta / (1 - 2 ** (1 - s))<br>    if s &lt; 0:<br>        from math import sin, gamma<br>        z = 2 ** s * pi ** (s - 1) * sin(pi * s / 2) * gamma(1 - s) * riemann_zeta(1 - s, n)<br>    return z<br><br><br># ---------------------------------------------------------------------------<br># Parser<br># ---------------------------------------------------------------------------<br>def parse_series(text, default_zeta_terms=5):<br>    text = text.replace(&quot;+&quot;, &quot;,&quot;).replace(&quot;;&quot;, &quot;,&quot;)<br>    tokens = [t.strip() for t in text.split(&quot;,&quot;) if t.strip()]<br>    if not tokens:<br>        raise ValueError(&quot;Empty series.&quot;)<br><br>    multipliers, labels = [], []<br>    zeta_info = []<br><br>    for tok in tokens:<br>        m = re.fullmatch(r&quot;zeta\s*\(\s*([-\d\.]+)\s*\)\s*(?::\s*(\d+))?&quot;, tok.lower())<br>        if m:<br>            s = float(m.group(1))<br>            N = int(m.group(2)) if m.group(2) else default_zeta_terms<br>            if N &lt; 1:<br>                raise ValueError(f&quot;zeta({s}):N needs N &gt;= 1&quot;)<br>            if s == 1:<br>                raise ValueError(&quot;zeta(1) diverges — pick s ≠ 1&quot;)<br><br>            terms = [1.0 / (n ** s) for n in range(1, N + 1)]<br>            partial_sum = sum(terms)<br>            zeta_val = riemann_zeta(s)<br>            zeta_info.append((s, N, partial_sum, zeta_val))<br><br>            for n, w in enumerate(terms, start=1):<br>                multipliers.append(w)<br>                labels.append(f&quot;ζ({s:g}) n={n}: 1/{n}^{s:g} = {w:.4g}&quot;)<br>            continue<br><br>        try:<br>            v = float(Fraction(tok))<br>        except (ValueError, ZeroDivisionError):<br>            raise ValueError(f&quot;Invalid entry: &#39;{tok}&#39;&quot;)<br>        if v &lt;= 0:<br>            raise ValueError(f&quot;Multiplier must be positive: &#39;{tok}&#39;&quot;)<br>        multipliers.append(v)<br>        labels.append(f&quot;×{v:g}&quot;)<br><br>    if not multipliers:<br>        raise ValueError(&quot;Series is empty.&quot;)<br>    return multipliers, labels, {&quot;zeta&quot;: zeta_info}<br><br><br># ---------------------------------------------------------------------------<br># Build terms<br># ---------------------------------------------------------------------------<br>def build_terms(t, base_freq, multipliers, phase_step=np.pi):<br>    terms = [np.sin(2 * np.pi * base_freq * m * t + phase_step * k)<br>             for k, m in enumerate(multipliers)]<br>    total = np.sum(terms, axis=0)<br>    return terms, total<br><br><br># ---------------------------------------------------------------------------<br># Area / integral estimation<br># ---------------------------------------------------------------------------<br>def half_wave_areas(t, y):<br>    &quot;&quot;&quot;<br>    Detect zero crossings of y and integrate |y| (and signed y) on each<br>    half-cycle. Returns list of dicts:<br>        {i_start, i_end, t_start, t_end, signed_area, abs_area}<br>    &quot;&quot;&quot;<br>    # Find sign changes<br>    s = np.sign(y)<br>    s[s == 0] = 1                              # treat exact zeros as positive<br>    changes = np.where(np.diff(s) != 0)[0]<br>    # Boundaries include start and end of the array<br>    boundaries = np.concatenate(([0], changes + 1, [len(t) - 1]))<br><br>    halves = []<br>    for i in range(len(boundaries) - 1):<br>        a, b = boundaries[i], boundaries[i + 1]<br>        if b &lt;= a:<br>            continue<br>        tt = t[a:b + 1]<br>        yy = y[a:b + 1]<br>        halves.append({<br>            &quot;i_start&quot;: a, &quot;i_end&quot;: b,<br>            &quot;t_start&quot;: float(tt[0]), &quot;t_end&quot;: float(tt[-1]),<br>            &quot;signed_area&quot;: float(np.trapz(yy, tt)),<br>            &quot;abs_area&quot;:    float(np.trapz(np.abs(yy), tt)),<br>        })<br>    return halves<br><br><br>def area_report(t, y):<br>    &quot;&quot;&quot;<br>    Returns a dict with:<br>      - signed_total   : ∫ y dt          over the whole window<br>      - abs_total      : ∫ |y| dt        over the whole window<br>      - n_half_waves   : number of half-cycles<br>      - half_waves     : list of per-half-cycle info<br>      - mean_abs_half  : mean absolute area of a half-wave<br>    &quot;&quot;&quot;<br>    signed_total = float(np.trapz(y, t))<br>    abs_total    = float(np.trapz(np.abs(y), t))<br>    halves       = half_wave_areas(t, y)<br>    mean_abs_half = (np.mean([h[&quot;abs_area&quot;] for h in halves])<br>                     if halves else 0.0)<br>    return {<br>        &quot;signed_total&quot;: signed_total,<br>        &quot;abs_total&quot;:    abs_total,<br>        &quot;n_half_waves&quot;: len(halves),<br>        &quot;half_waves&quot;:   halves,<br>        &quot;mean_abs_half&quot;: mean_abs_half,<br>    }<br><br><br># ---------------------------------------------------------------------------<br># Plot<br># ---------------------------------------------------------------------------<br>def plot_series(base_freq, multipliers, labels, meta=None,<br>                duration=4.0, n_points=8000, phase_step=np.pi,<br>                show_half_wave_shading=True, max_shaded_halves=40):<br>    t = np.linspace(0, duration, n_points)<br>    terms, total = build_terms(t, base_freq, multipliers, phase_step=phase_step)<br>    report = area_report(t, total)<br><br>    fig, ax = plt.subplots(figsize=(13, 7))<br>    cmap = plt.get_cmap(&quot;tab20&quot;)<br><br>    # --- terms (transparent) ---<br>    for k, (m, term) in enumerate(zip(multipliers, terms)):<br>        ax.plot(t, term, color=cmap(k % 20), lw=1.1, alpha=0.28,<br>                label=labels[k])<br><br>    # --- half-wave shading (positive = light red, negative = light blue) ---<br>    if show_half_wave_shading and report[&quot;half_waves&quot;]:<br>        shown = report[&quot;half_waves&quot;][:max_shaded_halves]<br>        for h in shown:<br>            a, b = h[&quot;i_start&quot;], h[&quot;i_end&quot;]<br>            color = &quot;red&quot; if h[&quot;signed_area&quot;] &gt; 0 else &quot;blue&quot;<br>            ax.fill_between(t[a:b + 1], total[a:b + 1], 0,<br>                            color=color, alpha=0.12, zorder=1)<br><br>    # --- final sum (opaque red) ---<br>    ax.plot(t, total, color=&quot;red&quot;, lw=3.0, zorder=5,<br>            label=f&quot;SUM of {len(multipliers)} terms&quot;)<br>    ax.axhline(0, color=&quot;gray&quot;, lw=0.5)<br>    ax.grid(True, alpha=0.3)<br><br>    # --- title with zeta convergence info ---<br>    title = (f&quot;Sum of sines — base f = {base_freq:g} Hz, &quot;<br>             f&quot;{len(multipliers)} terms, window = {duration:g} s&quot;)<br>    if meta and meta.get(&quot;zeta&quot;):<br>        zbits = [f&quot;ζ({s:g}) [{N} terms: partial={p:.4f} → ζ={z:.4f}]&quot;<br>                 for s, N, p, z in meta[&quot;zeta&quot;]]<br>        title += &quot;\n&quot; + &quot;   |   &quot;.join(zbits)<br>    ax.set_title(title, fontsize=10)<br>    ax.set_xlabel(&quot;time (s)&quot;)<br>    ax.set_ylabel(&quot;amplitude&quot;)<br><br>    # --- area report inset ---<br>    text = (<br>        &quot;AREA / INTEGRAL\n&quot;<br>        f&quot;signed ∫ sum dt   = {report[&#39;signed_total&#39;]: .5f}\n&quot;<br>        f&quot;absolute ∫|sum| dt = {report[&#39;abs_total&#39;]: .5f}\n&quot;<br>        f&quot;half-waves found   = {report[&#39;n_half_waves&#39;]}\n&quot;<br>        f&quot;mean |half-wave|   = {report[&#39;mean_abs_half&#39;]:.5f}\n&quot;<br>        f&quot;total area / mean  = &quot;<br>        f&quot;{(report[&#39;abs_total&#39;] / report[&#39;mean_abs_half&#39;]) if report[&#39;mean_abs_half&#39;] else 0:.2f} halves&quot;<br>    )<br>    ax.text(<br>        0.012, 0.02, text,<br>        transform=ax.transAxes, fontsize=9, family=&quot;monospace&quot;,<br>        va=&quot;bottom&quot;, ha=&quot;left&quot;,<br>        bbox=dict(boxstyle=&quot;round,pad=0.5&quot;, facecolor=&quot;white&quot;,<br>                  edgecolor=&quot;gray&quot;, alpha=0.9),<br>    )<br>    ax.legend(loc=&quot;upper right&quot;, fontsize=7, ncol=2, framealpha=0.9)<br>    fig.tight_layout()<br>    plt.show()<br><br>    return report<br><br><br># ---------------------------------------------------------------------------<br># Console summary of the half-wave table<br># ---------------------------------------------------------------------------<br>def print_half_wave_table(report, max_rows=20):<br>    halves = report[&quot;half_waves&quot;]<br>    print(f&quot;\nHalf-wave areas ({len(halves)} half-cycles found):&quot;)<br>    print(f&quot;{&#39;#&#39;:&gt;3}  {&#39;t_start&#39;:&gt;8}  {&#39;t_end&#39;:&gt;8}  {&#39;signed&#39;:&gt;10}  {&#39;|area|&#39;:&gt;10}&quot;)<br>    for i, h in enumerate(halves[:max_rows]):<br>        print(f&quot;{i+1:&gt;3}  {h[&#39;t_start&#39;]:&gt;8.4f}  {h[&#39;t_end&#39;]:&gt;8.4f}  &quot;<br>              f&quot;{h[&#39;signed_area&#39;]:&gt;10.5f}  {h[&#39;abs_area&#39;]:&gt;10.5f}&quot;)<br>    if len(halves) &gt; max_rows:<br>        print(f&quot;... {len(halves) - max_rows} more half-waves (truncated)&quot;)<br><br><br># ---------------------------------------------------------------------------<br># Entry point<br># ---------------------------------------------------------------------------<br>if __name__ == &quot;__main__&quot;:<br>    print(&quot;=== Sine Sum with Area / Integral ===&quot;)<br>    print(&quot;Entries: numbers/fractions, and zeta(x):N&quot;)<br>    print(&quot;   e.g.   1 + 1/2 + 1/4&quot;)<br>    print(&quot;          1 + zeta(2):6&quot;)<br>    print(&quot;          zeta(2):10&quot;)<br>    print()<br><br>    raw = input(&quot;Series (default: 1 + 1/2 + 1/4): &quot;).strip() or &quot;1 + 1/2 + 1/4&quot;<br><br>    try:<br>        default_zeta_terms = int(<br>            input(&quot;Default terms for zeta(x) without :N (default 5): &quot;).strip() or &quot;5&quot;)<br>    except ValueError:<br>        default_zeta_terms = 5<br><br>    multipliers, labels, meta = parse_series(raw, default_zeta_terms=default_zeta_terms)<br><br>    try:<br>        base_freq = float(input(&quot;Base frequency Hz (default 1): &quot;).strip() or &quot;1&quot;)<br>    except ValueError:<br>        base_freq = 1.0<br><br>    try:<br>        duration = float(input(&quot;Duration seconds (default 4): &quot;).strip() or &quot;4&quot;)<br>    except ValueError:<br>        duration = 4.0<br><br>    report = plot_series(base_freq, multipliers, labels, meta, duration=duration)<br>    print_half_wave_table(report)</pre><h4>9. WIP</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5f9cb4fde47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manejando Los Incentivos En El Gobierno y Afuera]]></title>
            <link>https://medium.com/@sumit.tripathi/manejando-los-incentivos-en-la-entidad-y-afuera-594f2ab9ee39?source=rss-ef8be19b30a6------2</link>
            <guid isPermaLink="false">https://medium.com/p/594f2ab9ee39</guid>
            <dc:creator><![CDATA[Sumit Tripathi]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 06:58:41 GMT</pubDate>
            <atom:updated>2026-10-08T09:16:50.230Z</atom:updated>
            <content:encoded><![CDATA[<h4>Usando ‘upside’ y ‘downside’ para mapear dónde faltamos</h4><p>Esta semana encuentro eventos que me da una idea sobre las funciones en el gobierno. La primera era la manera lo que las autoridades manejan las situaciones de inundaciones en la capital. Y me acuerdo sobre el concepto de ‘upside’ en que las personas no ven muchos beneficios para hacer algo y lo mejor opción es para no lo haga. Esto es lo mismo. Cuando la gente de cada organización piense como así, el equipo ya pierde. Cada persona piense que, si yo hago y aviso a toda la gente, pero no es cierto o etc., quizás va a encontrar unas resultas malas como necesita quita la organización, etc. Entonces, sería mejor si yo no lo digo. Pensé sobre problema por una gran duración.</p><p>Hoy, por suerte y por causalidad, mi hermanito, quien prefiere a ver la serie de Ted Lasso y es un futbolista, me dijo que hoy un cliente está enojado porque tiene un problema con su máquina y su proceso, y va a usar el método del coach como Pep para crear un incentivo para resolver este problema cara a cara. El consejo fue algunas veces necesitamos proteger los futbolistas desde gerente o personas que están enojado sobre ellos porque al final van a hacer si sienten seguro. Esto me da una idea sobre este problema que estoy buscando también.</p><p>Mira, cuando tenemos unas entidades, tenemos unas paredes que separar afuera y adentro. Y como en el modelo de apuesto, cada persona va a buscar las opciones que le da más beneficios. Pero las paredes pueden ayudarnos o obstruirnos también. En el contexto de unos departamentos del gobierno. Las paredes funcionan como una frontera impecable que el público a veces no pueden hacer nada. Entonces la persona adentro tiene un ‘’upside’’ masivo para no hacer nada si quieres esta protección.</p><p>Una manera para abalanzar esto es para crear un sistema de incentivo que reconocer acciones de pronostico o mantenimiento que la gente las hacen, pero no reciben algunos beneficios porque no tiene ‘upside’. El ‘’upside’’ en este contexto no es necesario en la forma de moneda a esta persona o personas porque esto puede dar incentivo para falsificar las resultas. Pero podemos dar reconocimientos afuera de la entidad o afuera del equipo más frecuentemente. Por qué afuera? Porque es necesario para reducir el efecto de ‘’upside’’ para hacer nada de las paredes entre las entidades.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*rx1MH5Xhjmlc-Hl9UVjglw.png" /><figcaption>Un ejemplo que quiero usar para entender el concepto mejor pero no es tan cierto todavía</figcaption></figure><p>Entonces, la idea que tengo yo es para conectar el ‘upside’ y ‘downside’ afuera y adentro de cada entidad — lo llamo ‘Crisscross’. En muchas entidades como el gobierno tiene el ‘upside’ interno y ‘downside’ público más que al revés. Para abalanzar bien, necesitamos reformar los incentivos más simétricos.</p><p>La otra manera es para ajustar la magnitud del beneficios o castigos de adentro y afuera de las entidades. En el caso del gobierno, si cuando no hacer nada, aunque sabemos que hay problema es mejor que hacer algo, es posible que el downside interno es más que el upside interno (y incluso del público). Entonces necesitamos crear unos incentivos entre interno y afuera también. El ‘whistleblower’ es una manera, el reconocimiento público cuando el pronostico es cierto es la otra. Premio o incentivos monedas es la otra, etc.</p><p>Desde el modelo de apuesto, si no hará unos incentivos, serían difícil para cambiar el sistema. Si el corte de los soldados es peor que el corte público, las personas harán lo mejor porque la entidad tiene castigos más graves. Además, los beneficios pueden ser mejor cuando ganamos juntos, cada persona puede obtener el bonus será mejor también.</p><blockquote><strong>Gana 2x! pierde 2x!</strong></blockquote><p>Así que la gente adentro de las entidades no siente que si hay problema con el público no necesita hacer nada porque la entidad tiene sistema que la protege mejor. Las entidades de hoy enfoquen a ganar <em>muchooo</em> más y dar <em>mucho</em> menos jaja.</p><blockquote>Comentario: Será muy interesante si pudiéramos mapear las resultas o elasticidades de los sistemas con upside y downside diferentes (1x vs. 1x , 2x vs. 2x, 1x vs. 3x, etc.)</blockquote><p>El otro ejemplo que tengo yo es el ejemplo de las tareas necesarias, pero no sienten muy especial por ejemplo mantener el baño, limpiar las calles y las tuberías de agua, etc. Estas tareas son necesarias, pero sentemos que son normales, sin embargo, cuando tienen problemas o se roten. Habrán gran problemas para todos. Entonces la pregunta sería cómo podemos ajustar los incentivos en este contexto así que el upside y downside son balanzas bien?</p><p>Podemos usar la manera arriba para abalanzar también por ejemplo:</p><p>método de Crisscross upside-downside privado y público:</p><p>Los empleados pueden recibir reconocimientos desde el público si pueden prevenir algunos problemas internos con antelación. O los empleados y sus equipos pueden recibir la moneda igual del valor de la cosita (¡pero si hubiera las estafas, recibiría 2x de las castigas también! — gana 2x~ pierde 2x! o más), etc.</p><h3>El Reto</h3><ul><li>Cuando pagamos porque rotemos algunas cositas, necesitamos pagar en total, pero si protegemos esta cosita no recibimos nada, solo el reconocimiento, esto también no esta simétrica ?? Sí de acuerdo, me parece que necesito ver y estudiar más sobre los métodos que podemos usar. Pero me alegro que esto es una perspectiva nueva que podemos enfatizar en día a día. Siempre escuchemos que los líderes grandes no solo son estrictos pero darían muchos cumplidos también.</li><li>etc.</li></ul><blockquote>Comentario: 7–8/10/26 — Anoche he escuchado sobre Cipolla y su tabla es muy parecedo como esta tabla de mío. Tal vez podemos combinar estas funcionas para crear unos incentivos para motivar mejor también.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=594f2ab9ee39" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>