PageSourceSearch

https://lifesim-psi.vercel.app/_next/static/chunks/2201.8c704e1e784e5474.js

js lifesim-psi.vercel.app collected 2026-10-03 07:16:43 UTC 10,135 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2201],{52201:function(e,t,s){s.r(t),s.d(t,{CoupledOscView:function(){return v}});var n=s(57437),i=s(21276),r=s(36496),o=s(85903),a=s(22288),l=s(5163),d=s(24606),c=s(2265),x=s(51448),u=s(389),p=s(7167);let h={position:"absolute",background:"rgba(12, 18, 28, 0.72)",border:"1px solid rgba(255,255,255,0.10)",borderRadius:12,padding:"14px 16px",color:"#e6edf3",font:"13px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",backdropFilter:"blur(8px)",pointerEvents:"auto"},m={padding:"6px 10px",borderRadius:8,border:"none",cursor:"pointer",font:"11px ui-sans-serif, system-ui, sans-serif",color:"#e6edf3",background:"rgba(255,255,255,0.10)"},f=[{color:"#90a4ae",label:"Wall (fixed anchor)"},{color:"#4dd0e1",label:"Outer spring (k)"},{color:"#ff7043",label:"Coupling spring (kc)",glow:!0},{color:"#4dd0e1",label:"Mass 1",glow:!0},{color:"#ffca28",label:"Mass 2",glow:!0}];function g(e){let{readout:t,k:s,kc:i,setKc:r,omegaSym:o,omegaAnti:a,paused:l,setPaused:d,onPreset:x}=e,{x1:u,x2:g,e1:y,e2:j,energy:b}=t,k=(0,c.useRef)([]);k.current.push({x1:u,x2:g}),k.current.length>160&&k.current.shift(),k.current.length;let v=e=>45-Math.max(-1.6,Math.min(1.6,e))/1.6*45,w=k.current.map((e,t)=>"".concat(0===t?"M":"L").concat((t/159*300).toFixed(1),",").concat(v(e.x1).toFixed(1))).join(" "),M=k.current.map((e,t)=>"".concat(0===t?"M":"L").concat((t/159*300).toFixed(1),",").concat(v(e.x2).toFixed(1))).join(" "),S=Math.round(y/Math.max(1e-9,b)*100),R=100-S;return(0,n.jsxs)("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[(0,n.jsx)(p.D,{items:f}),(0,n.jsxs)("div",{style:{...h,top:74,left:16,width:344},children:[(0,n.jsx)("div",{style:{fontSize:16,fontWeight:600},children:"Coupled oscillators \xb7 normal modes"}),(0,n.jsx)("div",{style:{opacity:.7,marginBottom:8},children:"x1'' = −k x1 + kc(x2−x1) \xa0 x2'' = −k x2 + kc(x1−x2)"}),(0,n.jsxs)("div",{style:{opacity:.85,fontSize:12},children:["Two equal masses, each anchored to a wall by an outer spring (",(0,n.jsx)("b",{children:"k"}),") and linked to each other by a ",(0,n.jsx)("b",{children:"coupling spring (kc)"}),". Push them ",(0,n.jsx)("b",{children:"in phase"})," and the coupling spring never stretches — they swing together at ",(0,n.jsx)("b",{children:"ω_sym = √(k)"}),". Push them ",(0,n.jsx)("b",{children:"out of phase"})," ","and the coupling spring works twice as hard — a faster ",(0,n.jsx)("b",{children:"ω_anti = √(k+2kc)"}),". Displace"," ",(0,n.jsx)("b",{children:"one mass alone"})," and you get a mix of both modes: the two frequencies drift apart, and the energy visibly ",(0,n.jsx)("b",{children:"beats"})," back and forth between the masses."]})]}),(0,n.jsxs)("div",{style:{...h,bottom:16,left:16,width:344},children:[(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:6,marginBottom:8},children:[["x1",u.toFixed(2),"#4dd0e1"],["x2",g.toFixed(2),"#ffca28"],["ω_sym",o.toFixed(2),"#4dd0e1"],["ω_anti",a.toFixed(2),"#ff7043"]].map(e=>{let[t,s,i]=e;return(0,n.jsxs)("div",{style:{textAlign:"center",background:"rgba(255,255,255,0.05)",borderRadius:8,padding:"5px 2px"},children:[(0,n.jsx)("div",{style:{fontSize:10,opacity:.7,color:i},children:t}),(0,n.jsx)("div",{style:{fontSize:14,fontWeight:600},children:s})]},t)})}),(0,n.jsxs)("div",{style:{fontSize:10,opacity:.6,marginBottom:2},children:["energy share: mass 1 ",S,"% \xb7 mass 2 ",R,"%"]}),(0,n.jsxs)("div",{style:{display:"flex",height:8,borderRadius:4,overflow:"hidden",marginBottom:8},children:[(0,n.jsx)("div",{style:{width:"".concat(S,"%"),background:"#4dd0e1"}}),(0,n.jsx)("div",{style:{width:"".concat(R,"%"),background:"#ffca28"}})]}),(0,n.jsx)("div",{style:{fontSize:10,opacity:.6,marginBottom:2},children:"x1(t) cyan \xb7 x2(t) gold"}),(0,n.jsxs)("svg",{width:300,height:90,style:{display:"block",background:"rgba(255,255,255,0.04)",borderRadius:6,marginBottom:10},children:[(0,n.jsx)("line",{x1:0,y1:45,x2:300,y2:45,stroke:"#90a4ae",strokeWidth:1,strokeDasharray:"4 3",opacity:.5}),(0,n.jsx)("path",{d:w,fill:"none",stroke:"#4dd0e1",strokeWidth:2}),(0,n.jsx)("path",{d:M,fill:"none",stroke:"#ffca28",strokeWidth:2})]}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,marginBottom:10,flexWrap:"wrap"},children:[(0,n.jsx)("button",{style:m,onClick:()=>d(!l),children:l?"▶ Play":"❚❚ Pause"}),(0,n.jsx)("button",{style:m,onClick:()=>
1x("in"),children:"In-phase mode"}),(0,n.jsx)("button",{style:m,onClick:()=>x("out"),children:"Out-of-phase mode"}),(0,n.jsx)("button",{style:m,onClick:()=>x("single"),children:"Single mass → beats"})]}),(0,n.jsxs)("label",{style:{display:"block"},children:[(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",opacity:.85,fontSize:12},children:[(0,n.jsx)("span",{children:"coupling strength kc"}),(0,n.jsxs)("span",{children:[i.toFixed(2)," (k = ",s.toFixed(2),")"]})]}),(0,n.jsx)("input",{type:"range",min:0,max:2,step:.02,value:i,onChange:e=>r(Number(e.target.value)),style:{width:"100%"}}),(0,n.jsx)("div",{style:{fontSize:10,opacity:.5},children:"stronger coupling → ω_anti pulls away from ω_sym → faster beats"})]})]})]})}var y=s(87318);function j(e){let t=new x.BufferGeometry;return t.setAttribute("position",new x.BufferAttribute(new Float32Array(60),3)),new x.Line(t,new x.LineBasicMaterial({color:e}))}function b(e,t,s){let n=e.geometry.getAttribute("position");n.set(function(e,t){let s=new Float32Array(60),n=(t-e)/19;for(let t=0;t<20;t++){let i=e+n*t,r=t>0&&t<19?t%2==0?.4:-.4:0;s[3*t]=i,s[3*t+1]=r,s[3*t+2]=0}return s}(t,s)),n.needsUpdate=!0}function k(e){let{paramsRef:t,onReadout:s}=e,r=(0,y.Z)(),o=(0,c.useRef)(0),a=(0,c.useRef)(-1),l=(0,c.useRef)((0,u.jR)((0,u.uYM)({k:1.2,kc:t.current.kc}),1.2)),d=(0,c.useRef)(null),x=(0,c.useRef)(null),p=(0,c.useMemo)(()=>j("#4dd0e1"),[]),h=(0,c.useMemo)(()=>j("#ff7043"),[]),m=(0,c.useMemo)(()=>j("#4dd0e1"),[]);return(0,i.F)((e,n)=>{if(!r.current)return;let i=l.current;i=(0,u.X3h)(i,{kc:t.current.kc});let c=t.current.preset;c.nonce!==a.current&&(a.current=c.nonce,i="in"===c.kind?(0,u.fC5)(i,1.2):"out"===c.kind?(0,u.LV8)(i,1.2):(0,u.jR)(i,1.2)),t.current.paused||(i=(0,u.dEE)(i,Math.min(.05,1.2*n))),l.current=i;let f=Math.max(-1.8,Math.min(1.8,1*i.x1)),g=Math.max(-1.8,Math.min(1.8,1*i.x2)),y=-2.5+f,j=2.5+g;if(d.current&&(d.current.position.x=y),x.current&&(x.current.position.x=j),b(p,-8,y),b(h,y,j),b(m,j,8),o.current+=n,o.current>.05){o.current=0;let e=(0,u.x_W)(i);s({x1:e.x1,v1:e.v1,x2:e.x2,v2:e.v2,e1:e.e1,e2:e.e2,energy:e.energy,t:e.t})}}),(0,n.jsxs)("group",{children:[(0,n.jsxs)("mesh",{position:[-8.2,0,0],children:[(0,n.jsx)("boxGeometry",{args:[.4,3,1.2]}),(0,n.jsx)("meshStandardMaterial",{color:"#90a4ae"})]}),(0,n.jsxs)("mesh",{position:[8.2,0,0],children:[(0,n.jsx)("boxGeometry",{args:[.4,3,1.2]}),(0,n.jsx)("meshStandardMaterial",{color:"#90a4ae"})]}),(0,n.jsx)("primitive",{object:p}),(0,n.jsx)("primitive",{object:h}),(0,n.jsx)("primitive",{object:m}),(0,n.jsxs)("mesh",{ref:d,position:[-2.5,0,0],children:[(0,n.jsx)("boxGeometry",{args:[1,1,1]}),(0,n.jsx)("meshStandardMaterial",{color:"#4dd0e1",emissive:"#4dd0e1",emissiveIntensity:.4,toneMapped:!1})]}),(0,n.jsxs)("mesh",{ref:x,position:[2.5,0,0],children:[(0,n.jsx)("boxGeometry",{args:[1,1,1]}),(0,n.jsx)("meshStandardMaterial",{color:"#ffca28",emissive:"#ffca28",emissiveIntensity:.4,toneMapped:!1})]}),(0,n.jsxs)("mesh",{position:[-2.5,-1,0],rotation:[Math.PI/2,0,0],children:[(0,n.jsx)("ringGeometry",{args:[.45,.5,24]}),(0,n.jsx)("meshBasicMaterial",{color:"#5a6b80",toneMapped:!1})]}),(0,n.jsxs)("mesh",{position:[2.5,-1,0],rotation:[Math.PI/2,0,0],children:[(0,n.jsx)("ringGeometry",{args:[.45,.5,24]}),(0,n.jsx)("meshBasicMaterial",{color:"#5a6b80",toneMapped:!1})]})]})}function v(){let[e,t]=(0,c.useState)(.5),[s,i]=(0,c.useState)(!1),[x,p]=(0,c.useState)({kind:"single",nonce:0}),[h,m]=(0,c.useState)({x1:1.2,v1:0,x2:0,v2:0,e1:0,e2:0,energy:0,t:0}),f=(0,c.useRef)({kc:e,paused:s,preset:x});f.current={kc:e,paused:s,preset:x};let y=(0,c.useMemo)(()=>(0,u.QjJ)(1.2),[]),j=(0,c.useMemo)(()=>(0,u.DY$)(1.2,e),[e]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.Xz,{camera:{position:[0,2,18],fov:50},style:{background:"#05070d"},gl:{antialias:!0},dpr:[1,2],children:[(0,n.jsx)("ambientLight",{intensity:.8}),(0,n.jsx)("directionalLight",{position:[10,20,30],intensity:.6}),(0,n.jsx)(k,{paramsRef:f,onReadout:m}),(0,n.jsx)(o.z,{enableDamping:!0}),(0,n.jsxs)(a.x,{children:[(0,n.jsx)(l.d,{mipmapBlur:!0,intensity:.55,luminanceThreshold:.45,luminanceSmoothing:.2}
1),(0,n.jsx)(d.s,{eskil:!1,offset:.3,darkness:.7})]})]}),(0,n.jsx)(g,{readout:h,k:1.2,kc:e,setKc:t,omegaSym:y,omegaAnti:j,paused:s,setPaused:i,onPreset:e=>p(t=>({kind:e,nonce:t.nonce+1}))})]})}},7167:function(e,t,s){s.d(t,{D:function(){return a}});var n=s(57437),i=s(2265);let r={position:"absolute",top:74,right:16,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6,zIndex:8,pointerEvents:"none"},o={background:"rgba(12, 18, 28, 0.72)",border:"1px solid rgba(255,255,255,0.10)",borderRadius:10,color:"#e6edf3",font:"12px/1.4 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif",backdropFilter:"blur(8px)",pointerEvents:"auto"};function a(e){let{items:t,title:s="Key"}=e,[a,l]=(0,i.useState)(!0);return(0,n.jsxs)("div",{style:r,children:[(0,n.jsxs)("button",{onClick:()=>l(e=>!e),style:{...o,display:"flex",alignItems:"center",gap:6,padding:"6px 11px",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{opacity:.7},children:a?"✕":"▤"}),(0,n.jsx)("span",{style:{fontWeight:600},children:s})]}),a&&(0,n.jsxs)("div",{style:{...o,padding:"10px 12px",maxWidth:230},children:[t.map(e=>(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:5},children:[(0,n.jsx)("span",{style:{flex:"0 0 auto",width:12,height:12,borderRadius:e.glow?6:3,background:e.color,boxShadow:e.glow?"0 0 7px ".concat(e.color):"none"}}),(0,n.jsx)("span",{style:{opacity:.9},children:e.label})]},e.label)),(0,n.jsx)("div",{style:{fontSize:10,opacity:.45,marginTop:2},children:"◍ glow = active node \xb7 ■ = molecule"})]})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.