%23%20gallery_category%3A%20Translation%20Examples%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.23.13%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20FLAMO%E2%86%92PR%20(Notebook)%0A%0A%20%20%20%20**In-depth%20math%20documentation**%20of%20the%20refinement%20fix%2C%20with%20an%20**SOS%20filter%20in%20the%20loop**%20and%20plotting.%0A%0A%20%20%20%20%23%23%20Goals%0A%0A%20%20%20%201.%20Build%20a%20delay%20state-space%20model%20with%20a%20**one-pole%20absorption%20(SOS)%20in%20the%20loop**%20via%20%60dss_to_flamo(...%2C%20sos_filter%3D...)%60.%0A%20%20%20%202.%20Extract%20poles%2Fresidues%20via%20%60pyFDN.flamo_to_pr%60.%0A%20%20%20%203.%20Explain%20the%20key%20math%20fix%3A%20why%20we%20evaluate%20Newton%2FEhrlich%E2%80%93Aberth%20in%20**w-plane**%20(%60w%20%3D%20z%5E%7B-1%7D%60)%20while%20FLAMO%20probing%20naturally%20gives%20derivatives%20in%20**z-plane**.%0A%20%20%20%204.%20Verify%20numerically%20that%20the%20derivative%20identities%20are%20consistent.%0A%20%20%20%205.%20Verify%20time-domain%20impulse%20response%20reconstruction%20from%20modal%20data%20and%20**plot%20poles%20%2B%20IR**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20---%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Notation%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20-%20Characteristic%20matrix%20of%20the%20recursive%20loop%20with%20feedforward%20%24F(z)%24%20and%20feedback%20%24G(z)%24%0A%20%20%20%20%24%24%0A%20%20%20%20P(z)%20%3D%20I%20-%20F(z)G(z)%0A%20%20%20%20%24%24%0A%20%20%20%20In%20the%20standard%20FDN%20delay%20form%20this%20matches%0A%20%20%20%20%24%24%0A%20%20%20%20P(z)%20%3D%20I%20-%20A%5C%2C%5Cmathrm%7Bdiag%7D(z%5E%7B-m_1%7D%2C%5Cdots%2Cz%5E%7B-m_N%7D).%0A%20%20%20%20%24%24%0A%0A%20%20%20%20-%20Transfer%20decomposition%3A%0A%20%20%20%20%24%24%0A%20%20%20%20H(z)%20%3D%20C(z)%5C%2CP(z)%5E%7B-1%7DF(z)B(z)%20%2B%20D(z).%0A%20%20%20%20%24%24%0A%0A%20%20%20%20-%20Poles%20are%20roots%20of%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cdet%20P(z)%3D0.%0A%20%20%20%20%24%24%0A%0A%20%20%20%20We%20use%20FLAMO's%20native%20recursion%20probes%20(%60probe_recursion%60%2C%20%60probe_recursion_with_derivative%60%2C%20%60log_det_derivative%60%2C%20%60log_det_derivative_w%60)%20directly.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%201)%20Core%20decomposition%20and%20residue%20formula%0A%0A%20%20%20%20Given%0A%20%20%20%20%24%24%0A%20%20%20%20H(z)%20%3D%20C(z)%5C%2CP(z)%5E%7B-1%7DF(z)B(z)%2BD(z)%2C%0A%20%20%20%20%24%24%0A%20%20%20%20and%20a%20simple%20pole%20%24%5Clambda_i%24%20where%20%24%5Cdet%20P(%5Clambda_i)%3D0%24%2C%20define%20right%2Fleft%20null%20vectors%0A%20%20%20%20%24%24%0A%20%20%20%20P(%5Clambda_i)r_i%3D0%2C%5Cqquad%20%5Cell_i%5EH%20P(%5Clambda_i)%3D0.%0A%20%20%20%20%24%24%0A%20%20%20%20Then%20the%20residue%20matrix%20is%0A%20%20%20%20%24%24%0A%20%20%20%20%5Crho_i%20%3D%20%5Cfrac%7B%5Cleft(C(%5Clambda_i)r_i%5Cright)%5Cleft(%5Cell_i%5EH%20F(%5Clambda_i)%20B(%5Clambda_i)%5Cright)%7D%7B%5Cell_i%5EH%5C%2C%5Cfrac%7BdP%7D%7Bdz%7D(%5Clambda_i)%5C%2Cr_i%7D.%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20is%20the%20adjugate-free%20null-vector%20formula%20used%20in%20%60flamo_to_pr%60.%0A%0A%20%20%20%20Why%20it%20is%20useful%3A%0A%20%20%20%20-%20It%20works%20for%20general%20matrix-polynomial%2Frational%20characteristic%20forms.%0A%20%20%20%20-%20It%20avoids%20explicitly%20forming%20adjugates.%0A%20%20%20%20-%20It%20aligns%20naturally%20with%20FLAMO%20probes%20for%20%24P(z)%24%2C%20%24dP%2Fdz%24%2C%20%24F(z)%24%2C%20%24B(z)%24%2C%20%24C(z)%24%2C%20%24D(z)%24.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%202)%20Newton%20term%20in%20z-plane%0A%0A%20%20%20%20For%20simultaneous%20pole%20refinement%20(Ehrlich%E2%80%93Aberth%20style)%2C%20we%20need%20a%20scalar%20Newton-like%20term.%20For%20matrix%20characteristic%20equations%2C%20the%20natural%20choice%20is%0A%20%20%20%20%24%24%0A%20%20%20%20N_z(z)%20%3D%20%5Cfrac%7Bd%7D%7Bdz%7D%5Clog%5Cdet%20P(z).%0A%20%20%20%20%24%24%0A%20%20%20%20Using%20Jacobi's%20formula%3A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7Bd%7D%7Bdz%7D%5Clog%5Cdet%20P(z)%20%3D%20%5Cmathrm%7Btr%7D%5Cleft(P(z)%5E%7B-1%7D%5Cfrac%7BdP%7D%7Bdz%7D(z)%5Cright).%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20is%20exactly%20what%20FLAMO%20exposes%20natively%20via%3A%0A%20%20%20%20-%20%60Recursion.log_det_derivative(z)%60%20(z-plane)%2C%20and%0A%20%20%20%20-%20%60Recursion.log_det_derivative_w(w)%60%20(w-plane).%0A%0A%20%20%20%20When%20these%20are%20available%20we%20can%20avoid%20numerical%20%60solve%2Btrace%60%20fallback%20for%20the%20Newton%20term.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%203)%20Why%20switch%20to%20w-plane%20(%24w%3Dz%5E%7B-1%7D%24)%3F%0A%0A%20%20%20%20For%20delay%20systems%2C%20the%20characteristic%20expression%20is%20naturally%20a%20polynomial-like%20object%20in%20%24w%3Dz%5E%7B-1%7D%24.%0A%0A%20%20%20%20Define%0A%20%20%20%20%24%24%0A%20%20%20%20q(w)%20%3D%20%5Cdet%20P(1%2Fw).%0A%20%20%20%20%24%24%0A%20%20%20%20Then%20poles%20in%20z%20map%20to%20roots%20in%20w%20by%20%24w_i%20%3D%201%2Fz_i%24.%0A%0A%20%20%20%20Chain%20rule%20gives%20the%20key%20identity%3A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7Bd%7D%7Bdw%7D%5Clog%20q(w)%0A%20%20%20%20%3D%20%5Cfrac%7Bd%7D%7Bdz%7D%5Clog%5Cdet%20P(z)%5Ccdot%5Cfrac%7Bdz%7D%7Bdw%7D%0A%20%20%20%20%3D%20N_z(z)%5Ccdot%5Cleft(-%5Cfrac%7B1%7D%7Bw%5E2%7D%5Cright)%0A%20%20%20%20%3D%20-z%5E2%20N_z(z)%2C%5Cquad%20z%3D1%2Fw.%0A%20%20%20%20%24%24%0A%20%20%20%20So%0A%20%20%20%20%24%24%0A%20%20%20%20N_w(w)%3A%3D%5Cfrac%7Bq'(w)%7D%7Bq(w)%7D%20%3D%20-z%5E2%5C%2CN_z(z).%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20is%20exactly%20the%20conversion%20implemented%20in%20the%20refinement%20step.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20---%0A%0A%20%20%20%20%23%23%23%20EAI%20form%20used%20in%20code%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20At%20pole%20index%20%24i%24%3A%0A%0A%20%20%20%201.%20Compute%20%24N_z(z_i)%24.%0A%20%20%20%202.%20Convert%20to%20w-plane%20Newton%20term%3A%0A%20%20%20%20%24%24%0A%20%20%20%20N_w(w_i)%20%3D%20-z_i%5E2%20N_z(z_i)%2C%5Cquad%20w_i%3D1%2Fz_i.%0A%20%20%20%20%24%24%0A%20%20%20%203.%20Deflation%20in%20w-plane%3A%0A%20%20%20%20%24%24%0A%20%20%20%20D_w(w_i)%3D%5Csum_%7Bj%5Cneq%20i%7D%5Cfrac%7B1%7D%7Bw_i-w_j%7D.%0A%20%20%20%20%24%24%0A%20%20%20%204.%20EAI%20update%20in%20w%3A%0A%20%20%20%20%24%24%0A%20%20%20%20w_i%5E%7B%5Ctext%7Bnew%7D%7D%20%3D%20w_i%20-%20%5Cfrac%7B1%7D%7BN_w(w_i)-D_w(w_i)%7D.%0A%20%20%20%20%24%24%0A%20%20%20%205.%20Map%20back%3A%0A%20%20%20%20%24%24%0A%20%20%20%20z_i%5E%7B%5Ctext%7Bnew%7D%7D%20%3D%201%2Fw_i%5E%7B%5Ctext%7Bnew%7D%7D.%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Using%20deflation%20directly%20in%20w-plane%20is%20important%20because%20roots%20are%20distributed%20more%20naturally%20for%20delay-polynomial%20structure%20there.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%204)%20Numerical%20stability%20note%0A%0A%20%20%20%20The%20refinement%20variable%20is%20now%20always%20%24w%24.%20So%20we%20evaluate%20Newton%20terms%20directly%20as%0A%20%20%20%20%24%24%0A%20%20%20%20N_w(w)%3D%5Cfrac%7Bd%7D%7Bdw%7D%5Clog%5Cdet%20P(1%2Fw)%0A%20%20%20%20%24%24%0A%20%20%20%20whenever%20FLAMO%20exposes%20%60log_det_derivative_w(w)%60.%0A%0A%20%20%20%20If%20only%20z-domain%20derivatives%20are%20available%2C%20we%20use%20the%20exact%20chain-rule%20fallback%3A%0A%20%20%20%20%24%24%0A%20%20%20%20N_w(w)%3D%20-%5Cfrac%7B1%7D%7Bw%5E2%7D%20N_z(1%2Fw)%2C%0A%20%20%20%20%5Cquad%20N_z(z)%3D%5Cfrac%7Bd%7D%7Bdz%7D%5Clog%5Cdet%20P(z).%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20keeps%20the%20optimization%20state%20in%20one%20variable%20(w)%20and%20minimizes%20numerical%20conversions%20during%20iteration.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20import%20torch%0A%0A%20%20%20%20import%20pyFDN%0A%0A%20%20%20%20np.random.seed(7)%0A%20%20%20%20print(%22pyFDN%20version%3A%22%2C%20getattr(pyFDN%2C%20%22__version__%22%2C%20%22unknown%22))%0A%20%20%20%20return%20np%2C%20plt%2C%20pyFDN%2C%20torch%0A%0A%0A%40app.cell%0Adef%20_(np%2C%20pyFDN%2C%20torch)%3A%0A%20%20%20%20%23%20Build%20a%20small%20stable%20FDN%20in%20DSS%20form%20with%20an%20SOS%20(first-order%20absorption)%20in%20the%20loop%0A%20%20%20%20Fs%20%3D%2048000.0%0A%20%20%20%20delays%20%3D%20np.array(%5B531%2C%20673%2C%20798%2C%20977%5D%2C%20dtype%3Dint)%0A%20%20%20%20build%20%3D%20pyFDN.fdn_build_gallery(%0A%20%20%20%20%20%20%20%20fs%3DFs%2C%0A%20%20%20%20%20%20%20%20delays%3Ddelays%2C%0A%20%20%20%20%20%20%20%20io_type%3D%22identity%22%2C%0A%20%20%20%20%20%20%20%20direct_gain%3D0.0%2C%0A%20%20%20%20%20%20%20%20rt%3DNone%2C%0A%20%20%20%20%20%20%20%20rng%3D7%2C%0A%20%20%20%20)%0A%0A%20%20%20%20%23%20First-order%20absorption%20in%20the%20loop%3A%20canonical%20(1%2C%206%2C%20N)%20SOS%20bank.%0A%20%20%20%20rt_dc%2C%20rt_ny%20%3D%200.5%2C%200.1%20%20%23%20reverb%20time%20at%20DC%20and%20Nyquist%20(seconds)%0A%20%20%20%20sos%20%3D%20pyFDN.first_order_absorption(rt_dc%2C%20rt_ny%2C%20build.delays%2C%20Fs)%0A%0A%20%20%20%20%23%20DSS%20-%3E%20FLAMO%20with%20SOS%20in%20the%20loop%20(delay%20-%3E%20filter%20-%3E%20A).%0A%20%20%20%20nfft%20%3D%202**16%0A%20%20%20%20model%20%3D%20pyFDN.dss_to_flamo(%0A%20%20%20%20%20%20%20%20A%3Dbuild.A%2C%0A%20%20%20%20%20%20%20%20B%3Dbuild.B%2C%0A%20%20%20%20%20%20%20%20C%3Dbuild.C%2C%0A%20%20%20%20%20%20%20%20D%3Dbuild.D%2C%0A%20%20%20%20%20%20%20%20m%3Dbuild.delays%2C%0A%20%20%20%20%20%20%20%20Fs%3DFs%2C%0A%20%20%20%20%20%20%20%20nfft%3Dnfft%2C%0A%20%20%20%20%20%20%20%20shell%3DTrue%2C%0A%20%20%20%20%20%20%20%20sos_filter%3Dsos%2C%0A%20%20%20%20%20%20%20%20dtype%3Dtorch.float64%2C%0A%20%20%20%20)%0A%20%20%20%20return%20Fs%2C%20delays%2C%20model%2C%20sos%0A%0A%0A%40app.cell%0Adef%20_(model%2C%20pyFDN)%3A%0A%20%20%20%20%23%20Run%20modal%20decomposition%20(delays%20and%20recursion%20are%20read%20from%20the%20model)%0A%20%20%20%20residues%2C%20poles%2C%20direct%2C%20is_pair%2C%20meta%20%3D%20pyFDN.flamo_to_pr(%0A%20%20%20%20%20%20%20%20model%2C%0A%20%20%20%20%20%20%20%20quality_threshold%3D1e-10%2C%0A%20%20%20%20%20%20%20%20refinement_tol%3D1e-10%2C%0A%20%20%20%20%20%20%20%20maximum_iterations%3D80%2C%0A%20%20%20%20%20%20%20%20reject_unstable_poles%3DTrue%2C%0A%20%20%20%20%20%20%20%20deflation_type%3D%22fullDeflation%22%2C%0A%20%20%20%20%20%20%20%20verbose%3DTrue%2C%0A%20%20%20%20)%0A%20%20%20%20return%20direct%2C%20is_pair%2C%20poles%2C%20residues%0A%0A%0A%40app.cell%0Adef%20_(%0A%20%20%20%20Fs%2C%0A%20%20%20%20delays%2C%0A%20%20%20%20direct%2C%0A%20%20%20%20is_pair%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20model%2C%0A%20%20%20%20np%2C%0A%20%20%20%20plt%2C%0A%20%20%20%20poles%2C%0A%20%20%20%20pyFDN%2C%0A%20%20%20%20residues%2C%0A%20%20%20%20sos%2C%0A)%3A%0A%20%20%20%20%23%20Reference%20IR%20from%20FLAMO%20(only%20way%20to%20get%20the%20true%20IR%20when%20the%20loop%20has%20an%20SOS)%0A%20%20%20%20ir_flamo%20%3D%20pyFDN.flamo_time_response(model%2C%20fs%3Dint(Fs)).squeeze()%0A%20%20%20%20if%20ir_flamo.ndim%20%3E%201%3A%0A%20%20%20%20%20%20%20%20ir_flamo%20%3D%20ir_flamo%5B%3A%2C%200%2C%200%5D%0A%20%20%20%20ir_flamo%20%3D%20np.asarray(ir_flamo%2C%20dtype%3Dnp.float64)%0A%0A%20%20%20%20%23%20Modal%20reconstruction%20and%20comparison%0A%20%20%20%20ir_len%20%3D%20min(20000%2C%20len(ir_flamo))%0A%20%20%20%20ir_modal%20%3D%20pyFDN.pr_to_impz(residues%2C%20poles%2C%20direct%2C%20is_pair%2C%20ir_len)%5B%3A%2C%200%2C%200%5D%0A%20%20%20%20ir_ref%20%3D%20ir_flamo%5B%3Air_len%5D%0A%0A%20%20%20%20err%20%3D%20np.max(np.abs(ir_ref%20-%20ir_modal))%0A%20%20%20%20print(%22max%20%7CIR_flamo%20-%20IR_modal%7C%3A%22%2C%20err)%0A%0A%20%20%20%20%23%20Plot%20poles%20in%20the%20complex%20plane%20with%20SOS%20gain-per-sample%20curve%0A%20%20%20%20angles_sos%2C%20mag_sos%20%3D%20pyFDN.sos_gain_per_sample_curves(sos%2C%20delays%2C%20nfft%3D512)%0A%20%20%20%20plt.figure(figsize%3D(10%2C%205))%0A%20%20%20%20plt.plot(%0A%20%20%20%20%20%20%20%20pyFDN.rad_to_hertz(angles_sos%2C%20Fs)%2C%0A%20%20%20%20%20%20%20%20pyFDN.lin_to_db(mag_sos)%2C%0A%20%20%20%20%20%20%20%20alpha%3D0.7%2C%0A%20%20%20%20%20%20%20%20label%3D%22SOS%20gain%20per%20sample%22%2C%0A%20%20%20%20)%0A%20%20%20%20plt.scatter(%0A%20%20%20%20%20%20%20%20pyFDN.rad_to_hertz(np.angle(poles)%2C%20Fs)%2C%0A%20%20%20%20%20%20%20%20pyFDN.lin_to_db(np.abs(poles))%2C%0A%20%20%20%20%20%20%20%20marker%3D%22.%22%2C%0A%20%20%20%20%20%20%20%20color%3D%22red%22%2C%0A%20%20%20%20%20%20%20%20label%3D%22Poles%22%2C%0A%20%20%20%20)%0A%20%20%20%20plt.xlabel(%22Frequency%20%5BHz%5D%22)%0A%20%20%20%20plt.ylabel(%22Magnitude%20%5BdB%5D%22)%0A%20%20%20%20%23%20plt.ylim(-1%2C1)%0A%20%20%20%20plt.title(%22SOS%20gain%20per%20sample%20and%20poles%20in%20the%20complex%20plane%22)%0A%20%20%20%20plt.grid(True%2C%20alpha%3D0.4)%0A%20%20%20%20plt.legend()%0A%20%20%20%20plt.tight_layout()%0A%20%20%20%20ax1%20%3D%20plt.gca()%0A%0A%20%20%20%20%23%20Plot%20FLAMO%20vs%20modal%20IR%0A%20%20%20%20_fig_ir%20%3D%20pyFDN.plot_impulse_response(%0A%20%20%20%20%20%20%20%20ir_ref%2C%0A%20%20%20%20%20%20%20%20ir_modal%2C%0A%20%20%20%20%20%20%20%20labels%3D%5B%22IR%20from%20FLAMO%22%2C%20%22IR%20from%20poles%2Fresidues%22%5D%2C%0A%20%20%20%20%20%20%20%20title%3D%22FLAMO%20time%20response%20vs%20modal%20reconstruction%22%2C%0A%20%20%20%20)%0A%0A%20%20%20%20mo.vstack(%5Bax1%2C%20_fig_ir%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%205)%20Practical%20interpretation%20of%20the%20fix%0A%0A%20%20%20%20%23%23%23%20What%20changed%20conceptually%0A%0A%20%20%20%20-%20**Before%3A**%20parts%20of%20the%20refinement%20were%20still%20expressed%20in%20z-domain%20and%20then%20converted%20for%20w%20updates.%0A%20%20%20%20-%20**Now%20(fully%20w-domain)%3A**%0A%20%20%20%20%20%20-%20Root%20variables%20are%20represented%20as%20%24w%24%20throughout%20refinement.%0A%20%20%20%20%20%20-%20Newton%20term%20is%20computed%20as%20%24d%2Fdw%5C%2C%5Clog%5Cdet%20P(1%2Fw)%24%20(native%20FLAMO%20when%20available%2C%20chain-rule%20fallback%20otherwise).%0A%20%20%20%20%20%20-%20Deflation%20and%20EAI%20update%20are%20done%20directly%20in%20%24w%24.%0A%20%20%20%20%20%20-%20Conversion%20to%20%24z%3D1%2Fw%24%20happens%20only%20once%20at%20the%20end%2C%20before%20residue%20computation.%0A%0A%20%20%20%20%23%23%23%20Why%20this%20is%20better%0A%0A%20%20%20%201.%20**Single-variable%20formulation%3A**%20easier%20to%20reason%20about%20and%20debug.%0A%20%20%20%202.%20**Closer%20to%20delay-polynomial%20structure%3A**%20delays%20are%20naturally%20polynomial%20in%20%24w%3Dz%5E%7B-1%7D%24.%0A%20%20%20%203.%20**Numerical%20robustness%3A**%20avoids%20repeated%20z%E2%86%94w%20conversion%20during%20iteration.%0A%20%20%20%204.%20**Lower%20layering%3A**%20direct%20calls%20into%20FLAMO%20recursion%20APIs%2C%20fewer%20adaptation%20layers.%0A%0A%20%20%20%20If%20you%20want%2C%20the%20next%20extension%20is%20to%20add%20a%20side-by-side%20diagnostic%20cell%20comparing%20convergence%20traces%20of%20the%20new%20fully-w%20formulation%20against%20a%20legacy%20z-formulation.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
487ecaf62e9e1dfed7906746b2edbdde