NYRAELUNE-V / make_figures.py
PureOne's picture
NYRAELUNE V 5.0.0: manuscript, exact solvers, and verification
fda6cea verified
Raw History Blame Contribute Delete
2.69 kB
"""Exact-formula scientific illustrations for coherent repair and flat sectors."""
from pathlib import Path
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
out=Path(__file__).resolve().parent
plt.rcParams.update({'font.size':10,'axes.spines.top':False,'axes.spines.right':False,'savefig.bbox':'tight'})
fig,axs=plt.subplots(1,2,figsize=(10.5,3.5),constrained_layout=True)
th=np.linspace(-np.pi,np.pi,900); c=np.cos(th);s=np.sin(th);den=c**4+s**4
axs[0].plot(th/np.pi,c**3*s/den,label=r'$g_1$',color='#225d89',lw=2)
axs[0].plot(th/np.pi,c*s**3/den,label=r'$g_2$',color='#ad425b',lw=2)
axs[0].axhline(0,color='black',lw=.5,alpha=.4)
axs[0].set(xlabel=r'Approach direction $\vartheta/\pi$',ylabel='Least-norm repair coefficient',title='Bounded directional limits disagree')
axs[0].legend(frameon=False,ncol=2)
z=np.geomspace(1e-3,1e3,400)
for r,color in [(1,'#555555'),(2,'#225d89'),(3,'#ad425b'),(5,'#7b5ba8')]:
axs[1].loglog(z,(1+z)**(r-1),label=f'{r} sector'+('s' if r!=1 else ''),color=color,lw=2)
axs[1].set(xlabel=r'Crossover scale $s=Nt^2$',ylabel=r'Exact limiting $\|G_N\|/N$',title='Every pencil squares to zero')
axs[1].legend(frameon=False,fontsize=9)
for ax in axs:ax.grid(True,alpha=.15)
fig.savefig(out/'coherence_and_words.pdf');fig.savefig(out/'coherence_and_words.png',dpi=180)
# A genuinely feedback-driven two-dimensional example, evaluated exactly
# before plotting; the second panel displays proved asymptotic exponents.
fig,axs=plt.subplots(1,2,figsize=(10.5,3.5),constrained_layout=True)
scales=np.linspace(.15,4,500)
for t,color in [(.1,'#999999'),(.03,'#ad425b'),(.01,'#225d89')]:
n=np.maximum(1,np.floor(scales/t)).astype(int)
a=np.exp(n*np.log1p(t)); b=np.exp(n*np.log1p(-t))
energy=(a+b)/2+(a-b)/(2*t)
axs[0].plot(n*t,energy/n,color=color,lw=1.3,label=fr'$t={t}$')
axs[0].plot(scales,np.sinh(scales)/scales,color='#111111',lw=2,
ls='--',label=r'$\sinh(s)/s$')
axs[0].set(xlabel=r'Feedback scale $s=Nt$',ylabel=r'$\|G_N\|/N$',
title='Exact feedback crossover')
axs[0].legend(frameon=False,fontsize=9)
kappa=np.linspace(0,.65,400)
for sigma,color in [(1,'#225d89'),(.5,'#ad425b')]:
exponent=np.maximum(0,2-4*kappa/sigma)
axs[1].plot(kappa,exponent,color=color,lw=2,label=fr'$\sigma={sigma:g}$')
axs[1].plot([sigma/2],[0],'o',color=color,ms=6)
axs[1].set(xlabel=r'Regularity budget exponent $K_N=N^\kappa$',
ylabel='Normalized energy growth exponent',
title='Sharp cost of coherent correction')
axs[1].legend(frameon=False,fontsize=9)
for ax in axs:ax.grid(True,alpha=.15)
fig.savefig(out/'feedback_and_resources.pdf')
fig.savefig(out/'feedback_and_resources.png',dpi=180)