"""Reproducible illustrative comparisons. Units are carried by column headings.
No measured material or commercial-solver results are generated here.
"""
import math
from math import pi,sqrt,exp,log,sin,cos
TABLES={}
def R(slug,headers,rows,note):TABLES[slug]={'headers':headers,'rows':rows,'note':note}
def H(en,ko):return [en,ko]
case=H('Condition','조건')
def bisect(f,lo,hi):
    assert f(lo)*f(hi)<=0
    for _ in range(90):
        mid=(lo+hi)/2
        if f(mid)>0:hi=mid
        else:lo=mid
    return (lo+hi)/2

R('stress-strain',[H('L (mm)','L (mm)'),H('k (N/mm)','k (N/mm)'),H('Extension (mm)','늘어남 (mm)'),H('Stress (MPa)','응력 (MPa)')],[[L,70000*100/L,1000*L/(70000*100),10] for L in [200,400]],H('Only length changes. The same stress and modulus produce a different component stiffness.','길이만 바꾸었습니다. 응력과 E가 같아도 구조 강성은 달라집니다.'))
R('materials-failure',[case,H('Stress (MPa)','응력 (MPa)'),H('Total strain','전체 변형률'),H('Extension / 100 mm','100 mm의 늘어남 (mm)')],[[H('Loaded','가력 상태'),210,.005,.5],[H('Elastic unload','탄성 제하'),0,.005-210/70000,100*(.005-210/70000)]],H('Unloading removes 0.3 mm elastically and leaves 0.2 mm; this does not require a damage law.','탄성적으로 0.3 mm 돌아오고 0.2 mm가 남습니다. 이 설명에는 손상 모델이 필요하지 않습니다.'))
R('vibration-shock',[H('m (kg)','m (kg)'),H('fn (Hz)','fn (Hz)'),H('ζ at c=1000','c=1000에서 ζ')],[[m,sqrt(1e6/m)/(2*pi),1000/(2*sqrt(1e6*m))] for m in [100,200]],H('Keep both spring stiffness and c fixed; neither frequency nor damping ratio stays fixed.','스프링 강성과 c를 고정했지만 진동수와 감쇠비는 모두 바뀝니다.'))
R('crash-energy',[case,H('Work (J)','일 (J)'),H('Mean force (N)','평균 힘 (N)'),H('Peak force (N)','최대 힘 (N)')],[[H('Flat plateau','일정한 힘'),5000*.05,5000,5000],[H('Linear rise','선형 증가'),.5*10000*.05,5000,10000]],H('The stroke is 50 mm in both cases; equal area leaves the peak undetermined.','두 경우 모두 스트로크 50 mm입니다. 면적을 맞추어도 피크는 하나로 결정되지 않습니다.'))
R('electrochemistry',[H('Capacity (Ah)','용량 (Ah)'),H('Removed (Ah)','제거 전하량 (Ah)'),H('Final SOC (%)','최종 SOC (%)')],[[Q,1.25,100*(.8-1.25/Q)] for Q in [5,4]],H('The same removed charge is a larger fraction of a smaller usable capacity.','같은 전하를 빼도 사용 가능 용량이 작으면 더 큰 비율을 제거합니다.'))
R('diffusion-kinetics',[H('Radius (μm)','반경 (μm)'),H('D (m²/s)','D (m²/s)'),H('R²/D (s)','R²/D (s)')],[[r,D,(r*1e-6)**2/D] for r,D in [(5,1e-14),(2.5,1e-14),(5,2e-14)]],H('Compare length squared against a linear change in diffusivity; these are scales, not exact completion times.','길이는 제곱, 확산계수는 일차로 영향을 줍니다. 완료 시각이 아니라 대표 규모입니다.'))
R('thermal-coupling',[H('hA (W/K)','hA (W/K)'),H('Steady rise (K)','최종 상승 (K)'),H('Time constant (s)','시간상수 (s)'),H('Rise at 200 s (K)','200 s 상승 (K)')],[[ha,2/ha,100/ha,2/ha*(1-exp(-200*ha/100))] for ha in [.5,1]],H('Increasing cooling changes both the final temperature and the rate of approach.','냉각을 늘리면 최종 온도와 그곳에 접근하는 속도가 함께 변합니다.'))
R('swelling-coupling',[case,H('Force (N)','힘 (N)'),H('Housing opening (mm)','하우징 벌어짐 (mm)'),H('Cell compression (mm)','셀 압축 (mm)')],[[H('K=10000 N/mm','K=10000 N/mm'),1.2/.00022,1.2/.00022/10000,1.2/.00022*.00012],[H('Rigid housing','강체 하우징'),1.2/.00012,0,1.2]],H('Opening plus compression always equals the prescribed 1.2 mm free growth.','벌어짐과 압축의 합은 지정한 자유 팽창 1.2 mm입니다.'))
R('fem-weak-form',[H('x (mm)','x (mm)'),H('N1','N1'),H('N2','N2'),H('u(x) (mm)','u(x) (mm)')],[[x,1-x/100,x/100,.05*x/100] for x in [0,25,50,100]],H('The interpolation recovers both nodal values and a constant gradient 0.0005.','보간은 두 절점 값을 재현하며 기울기는 0.0005로 일정합니다.'))
R('fem-assembly',[H('Node','절점'),H('u (mm)','u (mm)'),H('Applied f (N)','외력 f (N)'),H('Ku−f (N)','Ku−f (N)')],[[1,0,0,-1000],[2,.05,0,0],[3,.1,1000,0]],H('The nonzero constrained residual is the support reaction, not a failure of free-node equilibrium.','구속점의 0이 아닌 잔차는 지지 반력입니다. 자유 절점 평형 실패가 아닙니다.'))
R('fem-elements',[case,H('εxx','εxx'),H('εyy','εyy'),H('σxx (MPa)','σxx (MPa)'),H('σyy (MPa)','σyy (MPa)')],[[H('Poisson contraction','Poisson 수축'),.001,-.0003,1,0],[H('Suppress y strain','y 변형률 억제'),.001,0,1000*.001/.91,1000*.3*.001/.91]],H('Changing the imposed transverse field changes stress even with the same plane-stress material.','같은 평면응력 재료라도 지정한 횡변형장이 달라지면 응력이 달라집니다.'))
R('fem-convergence',[case,H('Displacement (mm)','변위 (mm)'),H('Change to finer (%)','직전 대비 변화 / 현재값 (%)')],[[H('h','h'),.8,None],[H('h/2','h/2'),.9,100*(.9-.8)/.9],[H('h/4','h/4'),.925,100*(.925-.9)/.925],[H('Extrapolated','외삽'),.925+.025/3,None]],H('The last mesh change and estimated remaining error are different quantities. This is a synthetic sequence.','마지막 메시 변화율과 추정 잔여 오차는 다릅니다. 실제 FE 결과가 아닌 설명용 수열입니다.'))
R('elasticity-plasticity',[H('Plastic strain','소성변형률'),H('Current yield (MPa)','현재 항복응력 (MPa)'),H('Total strain','전체 변형률')],[[ep,200+1000*ep,ep+(200+1000*ep)/70000] for ep in [0,.01,.02]],H('Read stress against plastic strain to get H; against total strain the tangent is EH/(E+H).','소성변형률 기준 기울기는 H이고 전체 변형률 기준은 EH/(E+H)입니다.'))
R('damage-evolution',[H('Crack area (mm²)','균열 면적 (mm²)'),H('Gf (N/mm)','Gf (N/mm)'),H('Total energy (J)','전체 에너지 (J)')],[[A,.5*100*.2,A*.5*100*.2/1000] for A in [20,100]],H('Multiply energy per area by the area; 1000 N·mm equals 1 J.','면적당 에너지에 면적을 곱합니다. 1000 N·mm가 1 J입니다.'))
R('fatigue-sn',[H('Amplitude (MPa)','진폭 (MPa)'),H('Life (cycles)','수명 (회)')],[[a,1e6*(100/a)**5] for a in [100,125,200]],H('The 200 MPa row illustrates wrongly entering the full range as amplitude for a ±100 MPa cycle.','±100 MPa 사이클에서 범위 200 MPa를 진폭으로 잘못 넣으면 마지막 행처럼 됩니다.'))
R('fatigue-mean-damage',[H('Repeated blocks','반복 블록'),H('Miner sum D','Miner 합 D')],[[n,n*(10000/100000+20000/1000000)] for n in [1,5,8]],H('D is a model sum, not the probability that the part has failed.','D는 모델의 합산값이며 부품이 파손되었을 확률이 아닙니다.'))
R('contact-friction',[H('Normal force (N)','수직력 (N)'),H('μN (N)','μN (N)'),H('Penetration (mm)','침투량 (mm)')],[[N,.2*N,N/100000] for N in [1000,500]],H('At fixed μ and penalty stiffness, changing normal force changes both screens. A 150 N tangential demand exceeds only the second friction limit.','μ와 페널티 강성을 고정하고 수직력을 바꾸면 둘 다 변합니다. 접선 요구력 150 N은 두 번째 마찰 한계만 넘습니다.'))
R('mesh-preparation',[H('Characteristic length (mm)','대표 길이 (mm)'),H('Transit / 5 mm value','5 mm 대비 통과시간')],[[L,L/5] for L in [5,1,.2]],H('Same wave speed and comparable formulation are assumed; this scaling does not certify mesh quality.','같은 파속과 유사한 요소를 가정한 규모 비교이며 메시 품질 판정은 아닙니다.'))
R('energy-checks',[H('Accounted total (J)','집계 합계 (J)'),H('Residual (J)','잔여 차이 (J)'),H('Residual / 100 J (%)','100 J 대비 차이 (%)')],[[total,100-total,100-total] for total in [100,97]],H('A nonzero residual first prompts checking definitions, omitted terms and histories, rather than applying a universal percentage limit.','잔여 차이는 일률적인 허용 비율보다 항 정의·누락·시간 이력을 먼저 확인하게 합니다.'))
R('stress-triaxiality',[case,H('Mean (MPa)','평균 (MPa)'),H('q (MPa)','q (MPa)'),H('η','η')],[[H('[120,0,0]','[120,0,0]'),40,120,1/3],[H('[200,80,80]','[200,80,80]'),120,120,1]],H('Mises stress stays fixed while hydrostatic tension changes. No fracture strain is assigned without calibration.','Mises 응력은 같고 정수압 인장은 바뀝니다. 보정 없이 파괴 변형률을 배정하지 않습니다.'))
R('fracture-mechanics',[H('Half-crack a (mm)','균열 반길이 a (mm)'),H('KI (MPa√m)','KI (MPa√m)'),H('G (N/mm)','G (N/mm)')],[[a,100*sqrt(pi*a)/sqrt(1000),10000*pi*a/70000] for a in [1,4]],H('The half-length, rather than the total crack length, is the input in this formula.','이 식의 입력은 전체 길이가 아니라 반길이입니다.'))
R('fatigue-strain-life',[H('Nf (cycles)','Nf (회)'),H('Elastic amplitude','탄성 진폭'),H('Plastic amplitude','소성 진폭'),H('Total amplitude','전체 진폭')],[[N,.005*(2*N)**(-.1),.5*(2*N)**(-.5),.005*(2*N)**(-.1)+.5*(2*N)**(-.5)] for N in [1000,10000]],H('The synthetic coefficients are fixed; the two contributions decay at different rates as life increases.','설명용 계수는 고정했습니다. 수명이 늘어날 때 두 기여분은 서로 다른 속도로 작아집니다.'))
R('bolt-preload',[H('P (kN)','P (kN)'),H('Bolt force (kN)','볼트 힘 (kN)'),H('Clamp force (kN)','체결력 (kN)')],[[P,20+.25*P,20-.75*P] for P in [0,10,20,20/.75]],H('The last row marks ideal separation. The closed-joint equations stop there.','마지막 행은 이상적인 분리 시작입니다. 닫힌 조인트 식의 적용은 여기까지입니다.'))
R('modal-participation',[case,H('Generalized mass (kg)','일반화 질량 (kg)'),H('Γ','Γ'),H('Effective mass (kg)','유효질량 (kg)')],[[H('[1,1]','[1,1]'),4,1,4],[H('[2,2]','[2,2]'),16,.5,4],[H('[1,−1]','[1,−1]'),4,0,0]],H('Input direction is [1,1]. Rescaling a mode does not change its effective mass for that input.','입력 방향은 [1,1]입니다. 모드 배율을 바꾸어도 이 입력의 유효질량은 같습니다.'))
R('test-correlation',[H('Sample','표본'),H('Observed (N)','관측 (N)'),H('Predicted (N)','예측 (N)'),H('Residual (N)','잔차 (N)')],[[i+1,y,p,p-y] for i,(y,p) in enumerate(zip([0,100,200],[0,110,180]))],H('Compute RMSE from squared residuals at matched samples; their signed average would allow cancellation.','맞춘 표본의 잔차 제곱으로 RMSE를 구합니다. 부호 있는 평균은 오차가 상쇄될 수 있습니다.'))
R('principal-stress-basics',[case,H('σ1 (MPa)','σ1 (MPa)'),H('σ2 (MPa)','σ2 (MPa)'),H('σ3 (MPa)','σ3 (MPa)'),H('Max shear (MPa)','최대 전단 (MPa)')],[[H('Original state','원래 상태'),90,0,-10,50],[H('Add 40 MPa hydrostatic tension','정수압 인장 40 MPa 추가'),130,40,30,50]],H('This is a changed physical state, not a coordinate rotation: all principals shift, but their differences and maximum shear stay fixed.','좌표 회전이 아니라 물리 상태를 바꾼 비교입니다. 주응력은 모두 이동하지만 차이와 최대 전단은 같습니다.'))
R('yield-criteria',[case,H('Equivalent measure at τ=130 MPa','τ=130 MPa의 판정값 (MPa)'),H('Tensile yield (MPa)','인장 항복 (MPa)')],[[H('von Mises','von Mises'),sqrt(3)*130,240],[H('Tresca','Tresca'),2*130,240]],H('Compare each measure with the same tensile calibration; their shear predictions need not agree.','각 판정값을 같은 인장 보정값과 비교합니다. 전단 예측이 같을 필요는 없습니다.'))
R('plastic-flow-hardening',[case,H('Stress (MPa)','응력 (MPa)'),H('Plastic strain','소성변형률'),H('Yield level (MPa)','항복 수준 (MPa)')],[[H('Elastic trial','탄성 시험값'),400,0,200],[H('After correction','보정 후'),400-200000*(200/201000),200/201000,200+1000*(200/201000)]],H('Corrected stress equals the updated, rather than the original, yield level.','보정 응력은 초기값이 아니라 갱신된 항복 수준과 같아집니다.'))
R('material-curve-input',[case,H('Value','값')],[[H('Engineering strain','공칭변형률'),.05],[H('Logarithmic total strain','대수 전체 변형률'),log(1.05)],[H('Elastic part','탄성 부분'),315/200000],[H('Plastic input','소성 입력'),log(1.05)-315/200000]],H('Only the last value belongs in the plastic-strain coordinate for this converted point.','이 변환 점에서 소성변형률 좌표에 들어가는 것은 마지막 값입니다.'))
R('virtual-work-energy',[H('Trial u (mm)','시험 u (mm)'),H('Π (N·mm)','Π (N·mm)'),H('dΠ/du (N)','dΠ/du (N)')],[[u,.5*1000*u*u-100*u,1000*u-100] for u in [0,.05,.1,.15,.2]],H('For this positive-stiffness spring, the stationary value is also a minimum. Negative potential does not mean negative stored elastic energy.','양의 강성인 이 스프링에서는 정류점이 최소점입니다. 포텐셜이 음수라는 것이 저장 탄성에너지가 음수라는 뜻은 아닙니다.'))
R('mapping-quadrature',[case,H('Integral of 1','1의 적분'),H('Integral of ξ²','ξ²의 적분')],[[H('One point','1점'),2,0],[H('Two points','2점'),2,2*(1/sqrt(3))**2],[H('Analytical','해석해'),2,2/3]],H('All integrals are over [−1,1]; agreement for one integrand does not establish another.','적분 구간은 모두 [−1,1]입니다. 한 함수에서 맞았다고 다른 함수에서도 맞는 것은 아닙니다.'))
R('element-verification',[case,H('Engineering γxy','공학 γxy'),H('Tensor εxy','텐서 εxy'),H('τxy (MPa)','τxy (MPa)')],[[H('Affine reference','선형장 기준'),.0001,.00005,1000/(2*1.3)*.0001],[H('Double cross-gradient terms','교차 기울기 두 배'),.0002,.0001,1000/(2*1.3)*.0002]],H('The material is unchanged. Scaling the shear part of the field scales the shear stress.','재료는 그대로입니다. 변위장의 전단 부분을 배율 변경하면 전단응력도 같은 배율로 바뀝니다.'))
R('elastoplastic-bending',[case,H('Moment (N·mm)','모멘트 (N·mm)'),H('Moment / My','My 대비')],[[H('First yield','최초 항복'),200*20*4**2/6,1],[H('Twice yield curvature','항복 곡률 두 배'),200*20*(4**2/4-1/3),(200*20*(4**2/4-1/3))/(200*20*4**2/6)],[H('Plastic limit','소성 한계'),200*20*4**2/4,1.5]],H('The ideal elastic–perfectly plastic section retains a finite elastic core at twice yield curvature.','이상 탄성–완전소성 단면은 항복 곡률 두 배에서도 유한한 탄성 코어가 남습니다.'))
R('springback-residual-stress',[H('y (mm)','y (mm)'),H('Loaded stress (MPa)','가력 응력 (MPa)'),H('Residual stress (MPa)','잔류응력 (MPa)')],[[y,200,200-(14666.6666666667*y)/(20*4**3/12)] for y in [1,2]],H('Two points on the same side can retain opposite residual signs. The complete field, including the opposite side, is self-equilibrated.','같은 쪽의 두 점도 잔류응력 부호가 다를 수 있습니다. 반대쪽까지 포함한 전체 장은 자체 평형입니다.'))
R('thermal-stress-constraints',[case,H('Opening (mm)','늘어남 (mm)'),H('Stress (MPa)','응력 (MPa)')],[[H('Free','자유'),200*23e-6*40,0],[H('K=EA/L','K=EA/L'),200*23e-6*40/2,-70000*23e-6*40/2],[H('Axially fixed','축방향 고정'),0,-70000*23e-6*40]],H('The restraint converts prevented thermal expansion into elastic compression.','구속이 막은 열팽창이 탄성 압축으로 바뀝니다.'))
R('buckling-stability',[H('Length (mm)','길이 (mm)'),H('Pinned Pcr (N)','양단 힌지 Pcr (N)'),H('Axial yield (N)','축항복 (N)')],[[L,pi*pi*70000*45/L**2,60*200] for L in [300,150]],H('Length changes stability without changing the axial area or material yield level.','길이는 단면적이나 재료 항복 수준을 바꾸지 않고 안정성을 바꿉니다.'))
R('stress-concentration-singularity',[H('r (mm)','r (mm)'),H('Synthetic singular stress (MPa)','설명용 특이 응력 (MPa)')],[[r,100*sqrt(1/r)] for r in [1,.25,.0625]],H('This synthetic divergence differs from the finite 150 MPa circular-hole maximum under the stated infinite-plate assumptions.','이 발산 수열은 지정한 무한 평판 원공의 유한한 최대응력 150 MPa와 다릅니다.'))
R('modal-boundary-conditions',[H('kc (N/m)','kc (N/m)'),H('In-phase (Hz)','동상 (Hz)'),H('Out-of-phase (Hz)','역상 (Hz)')],[[kc,sqrt(100000/10)/(2*pi),sqrt((100000+2*kc)/10)/(2*pi)] for kc in [50000,100000]],H('Only the relative-motion mode stretches the coupling spring.','상대 운동 모드만 연결 스프링을 늘립니다.'))
R('load-paths-beam-actions',[H('600 N position (mm)','600 N 위치 (mm)'),H('RA (N)','RA (N)'),H('RB (N)','RB (N)'),H('Max M (N·mm)','최대 M (N·mm)')],[[x,1000-(600*x+400*700)/1000,(600*x+400*700)/1000,(1000-(600*x+400*700)/1000)*x] for x in [300,500]],H('Moving one load redistributes reactions and changes the peak moment without changing the total force.','하중 하나를 옮기면 합력은 그대로지만 반력 분배와 최대 모멘트가 바뀝니다.'))
R('fem-consistent-loads',[case,H('Left nodal load (N)','왼쪽 절점 힘 (N)'),H('Right nodal load (N)','오른쪽 절점 힘 (N)'),H('Work for δu=[0,1] mm (N·mm)','δu=[0,1] mm의 일 (N·mm)')],[[H('Consistent','일관 분배'),100,100,100],[H('All at the right','오른쪽에 집중'),0,200,200]],H('For this virtual displacement, preserving force sum alone doubles the work.','이 가상변위에서는 힘의 합만 유지한 집중 분배가 일을 두 배로 만듭니다.'))
R('fem-matrix-foundations',[H('Rigid offset (mm)','강체 이동량 (mm)'),H('u1 (mm)','u1 (mm)'),H('u2 (mm)','u2 (mm)'),H('u3 (mm)','u3 (mm)'),H('Extensions (mm)','각 늘어남 (mm)')],[[d,d,d+.1,d+.15,'0.10 / 0.05'] for d in [0,1]],H('The second row changes the prescribed reference position; spring extensions and internal forces remain the same.','두 번째 행은 기준 위치를 옮겼습니다. 스프링 늘어남과 내력은 같습니다.'))
R('fem-bar-element',[H('Elements','요소 수'),H('Per-element k (N/mm)','요소당 k (N/mm)'),H('Tip u (mm)','끝 u (mm)')],[[n,70000*100/(200/n),1000*200/(70000*100)] for n in [1,2,4]],H('The uniform end-loaded bar is exactly representable by linear elements, so this refinement does not change its tip displacement.','균일한 끝 하중 봉은 선형 요소로 정확히 표현되어 이 세분화로 끝 변위가 바뀌지 않습니다.'))
R('tensor-compatibility',[H('x (mm)','x (mm)'),H('y (mm)','y (mm)'),H('εxx','εxx'),H('γxy','γxy'),H('εxy','εxy')],[[x,10,1e-5*10,1e-5*x,1e-5*x/2] for x in [10,20,40]],H('The varying shear is compatible here because it was derived from the same displacement field.','여기서는 같은 변위장에서 미분했으므로 위치에 따라 달라지는 전단도 적합합니다.'))
R('ritz-galerkin',[H('x (mm)','x (mm)'),H('Linear trial (mm)','일차 근사 (mm)'),H('Exact (mm)','정확해 (mm)')],[[x,.05*x/100,10*(100*x-x*x/2)/1e6] for x in [0,25,50,75,100]],H('The tip agrees, but the field between the boundaries does not.','끝은 일치하지만 경계 사이의 장은 다릅니다.'))
R('quadratic-interpolation',[H('Node x (mm)','절점 x (mm)'),H('Consistent load (N)','일관 하중 (N)'),H('Solved u (mm)','변위 u (mm)')],[[0,1000/6,0],[50,4000/6,.0375],[100,1000/6,.05]],H('Midpoint displacement is independent here; it no longer has to be half the tip value.','중간 변위가 독립적이므로 끝 변위의 절반일 필요가 없습니다.'))
R('plane-models',[case,H('σxx (MPa)','σxx (MPa)'),H('σyy (MPa)','σyy (MPa)'),H('σzz (MPa)','σzz (MPa)')],[[H('Plane stress','평면응력'),70/.91,21/.91,0],[H('Plane strain','평면변형률'),70*.7/(1.3*.4),70*.3/(1.3*.4),70*.3/(1.3*.4)]],H('The prescribed in-plane strains are the same; the out-of-plane restriction changes the stresses.','면내 지정 변형률은 같습니다. 면외 제한이 응력을 바꿉니다.'))
def psd(lo,hi):
    n=20000;df=(hi-lo)/n
    def y(f):
        r=f/30;return .01*(1+(.1*r)**2)/((1-r*r)**2+(.1*r)**2)
    variance=df*(.5*y(lo)+.5*y(hi)+sum(y(lo+i*df) for i in range(1,n)))
    return sqrt(variance)
R('random-vibration-psd',[case,H('Input RMS (g)','입력 RMS (g)'),H('Output RMS (g)','출력 RMS (g)')],[[H('20–80 Hz','20–80 Hz'),sqrt(.01*60),psd(20,80)],[H('100–160 Hz','100–160 Hz'),sqrt(.01*60),psd(100,160)]],H('Equal input variance excites different parts of the transfer function. Integration uses a one-sided PSD and a zero-mean stationary input.','같은 입력 분산도 전달함수의 다른 부분을 가진합니다. 단측 PSD와 평균 0의 정상 입력을 가정한 적분입니다.'))
R('shock-response-spectrum',[H('Duration (ms)','지속시간 (ms)'),H('Peak base (g)','기초 피크 (g)'),H('Base Δv (m/s)','기초 Δv (m/s)')],[[T*1000,10,2*98.0665*T/pi] for T in [.011,.022]],H('This table integrates the input pulse. It does not multiply every SRS response by the same factor.','이 표는 입력 펄스를 적분한 것입니다. 모든 SRS 응답에 같은 배율을 곱한다는 뜻이 아닙니다.'))
points=[(0,0),(10,80),(20,40),(40,40),(60,40),(80,40)]
work=0;crush=[]
for (x0,f0),(x1,f1) in zip(points,points[1:]):
    area=(f0+f1)/2*(x1-x0);work+=area;crush.append([f'{x0}–{x1}',area,work])
R('crush-force-intrusion',[H('Stroke interval (mm)','스트로크 구간 (mm)'),H('Interval work (J)','구간 일 (J)'),H('Accumulated work (J)','누적 일 (J)')],crush,H('kN×mm equals J; summing the areas gives 3400 J without using the separate local intrusion.','kN×mm는 J입니다. 별도의 국부 침입량을 쓰지 않고 면적 합으로 3400 J를 구합니다.'))
R('contact-gap-interference',[H('Approach u (mm)','접근 u (mm)'),H('Hard-contact force (N)','Hard contact 힘 (N)'),H('Penalty force (N)','페널티 힘 (N)')],[[u,1000*max(0,u-.2),max(0,u-.2)/(.001+.0001)] for u in [.1,.2,.3,.5]],H('No compression force occurs before the initial gap closes in this one-dimensional model.','이 1차원 모델에서는 초기 간극이 닫히기 전 압축력이 없습니다.'))
R('preload-scatter-slip',[H('Fi (kN)','Fi (kN)'),H('Bolt (kN)','볼트 (kN)'),H('Clamp (kN)','체결력 (kN)'),H('μ×clamp (kN)','μ×체결력 (kN)')],[[fi,fi+3,fi-9,.2*(fi-9)] for fi in [12,16,20]],H('Both improved slip resistance and increased bolt load are visible in the same comparison.','미끄럼 저항 증가와 볼트 하중 증가를 함께 볼 수 있습니다.'))
def padstrain(F):return bisect(lambda e:.2*e+4*e**3-F/10000,0,.6)
e0=padstrain(500)
def padforce(growth):return bisect(lambda F:(F-500)*.00004+6*(padstrain(F)-e0)-growth,500,5000)
R('nonlinear-pad-stack',[H('Added growth (mm)','추가 팽창 (mm)'),H('Total force (N)','전체 힘 (N)'),H('Force increase (N)','힘 증가 (N)'),H('Pad increase (mm)','패드 추가 압축 (mm)')],[[g,padforce(g),padforce(g)-500,6*(padstrain(padforce(g))-e0)] for g in [0,.4,.8]],H('Every row uses the assembled 500 N reference. Pad compression plus (F−500)×0.00004 closes each growth budget.','모든 행은 조립 기준 500 N에서 시작합니다. 패드 압축과 (F−500)×0.00004의 합이 각 팽창량을 맞춥니다.'))
R('test-boundary-stiffness',[H('K/kc','K/kc'),H('Force (N)','힘 (N)'),H('Force / rigid (%)','강체 대비 힘 (%)'),H('Fixture opening (mm)','지그 벌어짐 (mm)')],[[r,1000*r/(r+1),100*r/(r+1),1/(r+1)] for r in [.1,1,10,100]],H('A fixture one hundred times stiffer still has finite compliance; its effect is quantified rather than named away.','100배 단단한 지그도 유한한 컴플라이언스를 가집니다. 명칭 대신 그 영향을 수치로 확인합니다.'))
R('fixture-compliance',[H('Corrected motion (mm)','보정 변위 (mm)'),H('Absolute uncertainty (mm)','절대 불확실성 (mm)'),H('Relative (%)','상대값 (%)')],[[u,sqrt(.002**2+.005**2+.0005**2),100*sqrt(.002**2+.005**2+.0005**2)/u] for u in [.1,.01]],H('The second row holds the same illustrative absolute uncertainty, showing the subtraction problem for a much stiffer specimen.','두 번째 행은 같은 설명용 절대 불확실성을 유지하여 더 단단한 시편에서의 뺄셈 문제를 보여줍니다.'))
R('parameter-identification',[case,H('E (MPa)','E (MPa)'),H('Cf (mm/N)','Cf (mm/N)'),H('Cm at L=10 (mm/N)','L=10의 Cm (mm/N)'),H('Cm at L=20 (mm/N)','L=20의 Cm (mm/N)')],[[H('Candidate A','후보 A'),100,.0005,10/(100*100)+.0005,20/(100*100)+.0005],[H('Candidate B','후보 B'),200,.001,10/(200*100)+.001,20/(200*100)+.001]],H('Both match the first test; only A matches the second compliance 0.0025 mm/N under the common-fixture assumption.','둘 다 첫 시험을 맞추지만 공통 지그 가정에서 두 번째 0.0025 mm/N을 맞추는 것은 A입니다.'))
R('contact-pressure-distribution',[case,H('Resultant (N)','합력 (N)'),H('Mean (MPa)','평균 (MPa)'),H('Max patch (MPa)','최대 패치 (MPa)'),H('Area CV','면적 CV')],[[H('Four patches','네 패치'),2500*(.05+.1+.15+.1),.1,.15,sqrt((.05**2+.05**2)/4)/.1],[H('Uniform','균일'),10000*.1,.1,.1,0]],H('Equal force and mean do not imply equal spatial concentration.','같은 힘과 평균이 같은 공간적 집중을 뜻하지는 않습니다.'))
R('rainflow-damage-workflow',[H('Range (MPa)','범위 (MPa)'),H('Mean (MPa)','평균 (MPa)'),H('Amplitude (MPa)','진폭 (MPa)'),H('Life (cycles)','수명 (회)'),H('Damage per counted cycle','계수 사이클당 손상')],[[rng,mean,rng/2,1e6*(100/(rng/2))**5,1/(1e6*(100/(rng/2))**5)] for rng,mean in [(200,0),(100,50)]],H('One aggregate cycle of each class is assumed here. The mean-insensitive example intentionally leaves the mean unused in the life formula.','각 등급의 합산 사이클 1회를 가정합니다. 평균응력 비의존 예제이므로 평균은 수명식에서 의도적으로 사용하지 않습니다.'))
R('joint-model-selection',[H('Adhesive t (mm)','접착층 t (mm)'),H('Kn (N/mm³)','Kn (N/mm³)'),H('Total k (N/mm)','전체 k (N/mm)'),H('Force at 0.001 mm (N)','0.001 mm에서 힘 (N)')],[[t,2000/t,2000/t*100,2000/t*100*.001] for t in [.5,1]],H('Only thickness changes in this uniaxial elastic approximation; no strength is supplied.','이 단축 탄성 근사에서 두께만 바뀝니다. 강도는 제공하지 않았습니다.'))
R('battery-eigenstrain',[case,H('Free strain','자유 변형률'),H('Free growth (mm)','자유 팽창 (mm)'),H('Force (N)','힘 (N)')],[[H('Chemical only','화학만'),.005,120*.005,120*.005/.0015],[H('Chemical + thermal','화학 + 열'),.0054,120*.0054,120*.0054/.0015]],H('Independent additive contributions are assumed; a measured curve already containing thermal expansion must not be counted twice.','독립적인 가산 기여를 가정합니다. 열팽창이 포함된 측정 곡선은 중복 사용하지 않습니다.'))
R('pad-viscoelasticity',[H('Time (s)','시간 (s)'),H('Held 0.10 mm: force (N)','0.10 mm 고정: 힘 (N)'),H('Held 100 N: compression (mm)','100 N 고정: 압축 (mm)')],[[t,.1*(400+600*exp(-t/60)),100*(1/400-(1/400-1/1000)*exp(-t/150))] for t in [0,60,150,600]],H('Columns describe independent boundary-condition tests, not simultaneous force and displacement on one specimen.','열들은 서로 독립적인 경계조건 시험입니다. 한 시편에 동시에 지정한 힘과 변위가 아닙니다.'))
R('preloaded-modal-damping',[H('kt (N/m)','kt (N/m)'),H('fn at 10 kg (Hz)','10 kg에서 fn (Hz)')],[[k,sqrt(k/10)/(2*pi)] for k in [100000,144000]],H('A 44% tangent stiffness increase produces a 20% frequency increase. Damping is identified separately from the decay record.','접선강성 44% 증가가 진동수 20% 증가를 만듭니다. 감쇠는 별도 감쇠 기록에서 추정합니다.'))
R('damage-fatigue-observation',[case,H('d','d'),H('Eeff (MPa)','Eeff (MPa)'),H('Stress at εe=0.002 (MPa)','εe=0.002의 응력 (MPa)')],[[H('Undamaged scalar model','손상 없는 스칼라 모델'),0,70000,140],[H('Stiffness damage model','강성 손상 모델'),.2,.8*70000,.8*70000*.002]],H('These values follow the chosen scalar constitutive law; Miner D=0.30 from the separate fatigue example is not substituted for d.','이 값들은 선택한 스칼라 구성식의 결과입니다. 별도 피로 예제의 Miner D=0.30을 d에 대입하지 않습니다.'))
R('cell-module-pack-transfer',[H('Cells in series','직렬 셀 수'),H('Cell-stack k (N/mm)','셀 스택 k (N/mm)'),H('Free growth (mm)','자유 팽창 (mm)'),H('Force with same pads/housing (N)','같은 패드·하우징에서 힘 (N)')],[[n,2000/n,.2*n,.2*n/(n/2000+.001+.001)] for n in [1,2,4]],H('Cell count changes both free growth and cell compliance. Holding only one of those changes would describe a different assembly.','셀 수는 자유 팽창과 셀 컴플라이언스를 함께 바꿉니다. 하나만 바꾸면 다른 조립체를 계산합니다.'))
u=0;newton=[]
for i in range(5):
    residual=110-100*u-10*u**3;tangent=100+30*u*u;correction=residual/tangent;newton.append([i,u,residual,correction]);u+=correction
R('fem-nonlinear',[H('Iteration','반복'),H('Trial u (mm)','시험 u (mm)'),H('R (N)','R (N)'),H('Δu (mm)','Δu (mm)')],newton,H('All rows refer to the same 110 N target; the final correction is effectively zero.','모든 행은 같은 목표 110 N입니다. 마지막 보정량은 사실상 0입니다.'))
R('time-step-output',[H('Saved time (ms)','저장 시각 (ms)'),H('Unit half-sine','단위 반사인 값')],[[t,sin(pi*t)] for t in [0,.25,.5,.75,1]],H('Saving only the first and last rows hides the entire pulse. Sampling phase also matters.','첫 행과 마지막 행만 저장하면 펄스 전체를 놓칩니다. 저장 시점의 위상도 중요합니다.'))
R('mass-scaling-practice',[H('Mass (kg)','질량 (kg)'),H('fn (Hz)','fn (Hz)'),H('Signed particular amplitude (mm)','부호 있는 특수해 진폭 (mm)'),H('CDM stability boundary (s)','CDM 안정 경계 (s)')],[[m,sqrt(10000/m)/(2*pi),1000*10/(10000-m*80**2),2/sqrt(10000/m)] for m in [1,4]],H('The minus sign indicates a 180° phase reversal of the undamped harmonic particular solution, not a negative amplitude magnitude or a settling transient.','음수는 무감쇠 조화 특수해의 180° 위상 반전을 뜻합니다. 진폭 크기가 음수이거나 감쇠하며 정착하는 과도응답이라는 뜻은 아닙니다.'))
R('quasi-static-explicit',[H('Ramp T (s)','램프 T (s)'),H('Static target (mm)','정적 목표 (mm)'),H('Residual amplitude (mm)','잔류 진폭 (mm)')],[[T,1,2*abs(sin(100*T/2))/(100*T)] for T in [.02,.1,.5]],H('Residual amplitude follows the exact undamped force-ramp solution. A small value at one duration can include phase cancellation, so inspect the full ramp history too.','잔류 진폭은 무감쇠 힘 램프 정확해입니다. 특정 지속시간의 작은 값에는 위상 상쇄가 포함될 수 있어 램프 전체 이력도 봐야 합니다.'))

def verify():
    # Independent balances and reference values, rather than checks of formatting.
    assert abs(TABLES['plastic-flow-hardening']['rows'][1][1]-TABLES['plastic-flow-hardening']['rows'][1][3])<1e-10
    assert abs(work-3400)<1e-10
    assert abs(padforce(.8)-1549.354)<.001
    for growth in [0,.4,.8]:
        F=padforce(growth);assert abs(6*(padstrain(F)-e0)+(F-500)*.00004-growth)<1e-10
    assert abs(psd(20,80)-2.1100)<.0001
    assert abs(newton[-1][1]-1)<1e-10
    assert abs(TABLES['thermal-coupling']['rows'][0][3]-2.5284822353)<1e-9
    assert abs(TABLES['fracture-mechanics']['rows'][0][2]-.4487989505)<1e-9
    for v in TABLES.values():
        assert len(v['rows'])>=2
        for row in v['rows']:
            assert len(row)==len(v['headers'])
            for n in row:
                if isinstance(n,(int,float)):assert math.isfinite(n)
    return {'passed':True,'comparisons':len(TABLES),'scope':'Analytical illustrative arithmetic and selected independent balances; not FE or physical validation.'}

if __name__=='__main__':
    import json
    print(json.dumps(verify()))
