# SCRIPT: BH-FIGS-V8-5 # Figure f18 (a potential that stiffens toward coplanarity), from the formulas and sampling of BH-QUTRIT-18. # (a) the square lifted at fixed moment of inertia, in the signed coordinate sigma3 = 2h: gravity and like charges, # exact curves against the wall parabolas (2 sqrt2 - 1) sigma3^2 and -(2 sqrt2 - 1) sigma3^2; both curves are even, # and the ends sigma3 = +-1/sqrt3 are the two mirror-image regular tetrahedra (same G, fidelity 1). # (b) the rhombus family: the stiffness changes sign at diagonal ratio k* (BH-STIFF-19). import os as _os _HERE=_os.path.dirname(_os.path.abspath(__file__)) _FIG=_os.path.join(_HERE,'..','paper','fig') if _os.path.isdir(_os.path.join(_HERE,'..','paper','fig')) else _os.path.join(_HERE,'..','fig') import numpy as np, matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import os OUT=_FIG BG='#0f1115'; INK='#e6e8ec'; MUT='#9aa3ae'; RULE='#2a313c' C1='#3987e5'; C2='#d95926'; C3='#199e70'; C4='#c98500' plt.rcParams.update({'figure.facecolor':BG,'axes.facecolor':BG,'savefig.facecolor':BG,'text.color':INK, 'axes.labelcolor':INK,'xtick.color':MUT,'ytick.color':MUT,'axes.edgecolor':RULE,'font.family':'serif', 'font.serif':['TeX Gyre Pagella','URW Palladio L','Palatino','DejaVu Serif'],'mathtext.fontset':'cm','font.size':11}) def clean(ax): for s in ['top','right']: ax.spines[s].set_visible(False) k=2*np.sqrt(2)-1 def pair_sum(h): a=np.sqrt(0.25-h*h); q=[np.array([a,0,h]),np.array([-a,0,h]),np.array([0,a,-h]),np.array([0,-a,-h])] return sum(1/np.linalg.norm(q[i]-q[j]) for i in range(4) for j in range(i+1,4)) s=np.linspace(-1/np.sqrt(3),1/np.sqrt(3),801) # sigma3 = 2h (w3 = 4h^2 while 4h^2 <= 2a^2) S0=pair_sum(0.0) Ug=np.array([-(pair_sum(x/2)-S0) for x in s]); Uc=-Ug # check: evenness and the wall slope, printed print('max |U(s)-U(-s)| =', np.abs(Ug-Ug[::-1]).max()) print('U/sigma3^2 near the wall =', Ug[400+1]/s[400+1]**2, 'vs', k) print('tetrahedron rise =', Ug[-1], '(exact 2+4sqrt2-6sqrt(3/2) =', 2+4*np.sqrt(2)-6*np.sqrt(1.5), ')') # (b) the rhombus family (diagonal ratio k), closed form of BH-STIFF-19: dU/dw3 = (1/2)[4 sqrt2 - sqrt((1+k^2)/2)(1+1/k)] kk=np.linspace(0.06,1,600); Sk=0.5*(4*np.sqrt(2)-np.sqrt((1+kk**2)/2)*(1+1/kk)) kst=[x.real for x in np.roots([1,2,-62,2,1]) if abs(x.imag)<1e-12 and 0