{"slug": "show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes", "title": "Show HN: A NaN-immune explicit ODE solver that survives where RK4 explodes", "summary": "Independent researcher Pratyaksh Raj published the Pratyaksh Framework, a self-limiting TVD explicit Runge-Kutta family that stays 100% explicit and matrix-free while avoiding the NaN explosions that strike classical RK4 on stiff Neural ODE latent spaces. In a 120-step benchmark run via live_terminal_showdown.py at dt = 0.028, classical RK4 diverged from 10.775120 at step 001 to 5,810,720,740.52 by step 012 and returned NaN from step 013 onward, while the Pratyaksh solver remained stable, advancing from 2.087566 to 9.764465 over the same steps. The manuscript is posted as arXiv: math.NA / cs.CE and targets real-time physics, robotics, and scientific computing, where the standard workaround has been implicit solvers such as BDF that require large matrix computations.", "body_md": "**A Self-Limiting TVD Explicit Runge-Kutta Family for Real-Time Physics, Robotics, and Scientific Computing**\n\n**Author:** Pratyaksh Raj\n\n**Contact:** `pratyakshnarayanlal1@gmail.com`\n\n**Manuscript:** *The Pratyaksh Framework: A Self-Limiting TVD Explicit Runge-Kutta Family for Real-Time Physics, Robotics, and Scientific Computing* (arXiv: math.NA / cs.CE)\n\nIn continuous-depth ML (Neural ODEs), weight matrices often learn highly compressed, \"stiff\" latent spaces. Standard explicit solvers like RK4 or DOPRI5 suffer from catastrophic NaN explosions during these stiff transients, forcing the network to take infinitely small time-steps. The industry workaround is to use Implicit solvers (like BDF), which require computing massive \n\n**The Pratyaksh Framework** solves this by acting as an autonomous mathematical shock-absorber. It remains 100% explicit and matrix-free, yet gracefully navigates stiff latent manifolds without exploding.\n\nRunning the stiff Neural ODE benchmark (`python3 live_terminal_showdown.py`) demonstrates RK4 mathematically detonating, while the Pratyaksh framework automatically damps the shock:\n\n## **Click to expand full 120-step terminal output**\n\n```\n========================================================================\n LIVE TERMINAL SHOWDOWN: Classical RK4  vs.  The Pratyaksh Framework\n========================================================================\n Simulating highly stiff latent space... (dt = 0.028)\n\n Step | Time   | Pratyaksh 'u'       | Classical RK4 'u'   | Status\n------------------------------------------------------------------------\n 001  | 0.03s  |       2.087566  |       10.775120  | Running...\n 002  | 0.06s  |       2.179691  |       65.514174  | Running...\n 003  | 0.08s  |       2.276612  |      406.95  | 🚨 RK4 Diverging!\n 004  | 0.11s  |       2.378579  |     2536.62  | 🚨 RK4 Diverging!\n 005  | 0.14s  |       2.485855  |    15820.26  | 🚨 RK4 Diverging!\n 006  | 0.17s  |       2.598716  |    98675.61  | 🚨 RK4 Diverging!\n 007  | 0.20s  |       2.717453  |   615477.59  | 🚨 RK4 Diverging!\n 008  | 0.22s  |       2.842373  |  3838978.29  | 🚨 RK4 Diverging!\n 009  | 0.25s  |       2.973796  | 23945241.52  | 🚨 RK4 Diverging!\n 010  | 0.28s  |       3.112062  | 149356047.82  | 🚨 RK4 Diverging!\n 011  | 0.31s  |       3.257527  | 931593411.06  | 🚨 RK4 Diverging!\n 012  | 0.34s  |       3.410566  | 5810720740.52  | 🚨 RK4 Diverging!\n 013  | 0.36s  |       3.571574  | NaN              | 🟢 Pratyaksh Stable\n 014  | 0.39s  |       3.740965  | NaN              | 🟢 Pratyaksh Stable\n 015  | 0.42s  |       3.919177  | NaN              | 🟢 Pratyaksh Stable\n 016  | 0.45s  |       4.106668  | NaN              | 🟢 Pratyaksh Stable\n 017  | 0.48s  |       4.303922  | NaN              | 🟢 Pratyaksh Stable\n 018  | 0.50s  |       4.511447  | NaN              | 🟢 Pratyaksh Stable\n 019  | 0.53s  |       4.729779  | NaN              | 🟢 Pratyaksh Stable\n 020  | 0.56s  |       4.959479  | NaN              | 🟢 Pratyaksh Stable\n 021  | 0.59s  |       5.201141  | NaN              | 🟢 Pratyaksh Stable\n 022  | 0.62s  |       5.455387  | NaN              | 🟢 Pratyaksh Stable\n 023  | 0.64s  |       5.722872  | NaN              | 🟢 Pratyaksh Stable\n 024  | 0.67s  |       6.004286  | NaN              | 🟢 Pratyaksh Stable\n 025  | 0.70s  |       6.300355  | NaN              | 🟢 Pratyaksh Stable\n 026  | 0.73s  |       6.611841  | NaN              | 🟢 Pratyaksh Stable\n 027  | 0.76s  |       6.939547  | NaN              | 🟢 Pratyaksh Stable\n 028  | 0.78s  |       7.284319  | NaN              | 🟢 Pratyaksh Stable\n 029  | 0.81s  |       7.647045  | NaN              | 🟢 Pratyaksh Stable\n 030  | 0.84s  |       8.028660  | NaN              | 🟢 Pratyaksh Stable\n 031  | 0.87s  |       8.430147  | NaN              | 🟢 Pratyaksh Stable\n 032  | 0.90s  |       8.852542  | NaN              | 🟢 Pratyaksh Stable\n 033  | 0.92s  |       9.296933  | NaN              | 🟢 Pratyaksh Stable\n 034  | 0.95s  |       9.764465  | NaN              | 🟢 Pratyaksh Stable\n 035  | 0.98s  |      10.256345  | NaN              | 🟢 Pratyaksh Stable\n 036  | 1.01s  |      10.773839  | NaN              | 🟢 Pratyaksh Stable\n 037  | 1.04s  |      11.318282  | NaN              | 🟢 Pratyaksh Stable\n 038  | 1.06s  |      11.891078  | NaN              | 🟢 Pratyaksh Stable\n 039  | 1.09s  |      12.493701  | NaN              | 🟢 Pratyaksh Stable\n 040  | 1.12s  |      13.127707  | NaN              | 🟢 Pratyaksh Stable\n 041  | 1.15s  |      13.794729  | NaN              | 🟢 Pratyaksh Stable\n 042  | 1.18s  |      14.496486  | NaN              | 🟢 Pratyaksh Stable\n 043  | 1.20s  |      15.234788  | NaN              | 🟢 Pratyaksh Stable\n 044  | 1.23s  |      16.011537  | NaN              | 🟢 Pratyaksh Stable\n 045  | 1.26s  |      16.828736  | NaN              | 🟢 Pratyaksh Stable\n 046  | 1.29s  |      17.688490  | NaN              | 🟢 Pratyaksh Stable\n 047  | 1.32s  |      18.593017  | NaN              | 🟢 Pratyaksh Stable\n 048  | 1.34s  |      19.544648  | NaN              | 🟢 Pratyaksh Stable\n 049  | 1.37s  |      20.545835  | NaN              | 🟢 Pratyaksh Stable\n 050  | 1.40s  |      21.599159  | NaN              | 🟢 Pratyaksh Stable\n 051  | 1.43s  |      22.707336  | NaN              | 🟢 Pratyaksh Stable\n 052  | 1.46s  |      23.873221  | NaN              | 🟢 Pratyaksh Stable\n 053  | 1.48s  |      25.099820  | NaN              | 🟢 Pratyaksh Stable\n 054  | 1.51s  |      26.390295  | NaN              | 🟢 Pratyaksh Stable\n 055  | 1.54s  |      27.747972  | NaN              | 🟢 Pratyaksh Stable\n 056  | 1.57s  |      29.176351  | NaN              | 🟢 Pratyaksh Stable\n 057  | 1.60s  |      30.679113  | NaN              | 🟢 Pratyaksh Stable\n 058  | 1.62s  |      32.260132  | NaN              | 🟢 Pratyaksh Stable\n 059  | 1.65s  |      33.923482  | NaN              | 🟢 Pratyaksh Stable\n 060  | 1.68s  |      35.673453  | NaN              | 🟢 Pratyaksh Stable\n 061  | 1.71s  |      37.514553  | NaN              | 🟢 Pratyaksh Stable\n 062  | 1.74s  |      39.451530  | NaN              | 🟢 Pratyaksh Stable\n 063  | 1.76s  |      41.489375  | NaN              | 🟢 Pratyaksh Stable\n 064  | 1.79s  |      43.633341  | NaN              | 🟢 Pratyaksh Stable\n 065  | 1.82s  |      45.888955  | NaN              | 🟢 Pratyaksh Stable\n 066  | 1.85s  |      48.262031  | NaN              | 🟢 Pratyaksh Stable\n 067  | 1.88s  |      50.758685  | NaN              | 🟢 Pratyaksh Stable\n 068  | 1.90s  |      53.385352  | NaN              | 🟢 Pratyaksh Stable\n 069  | 1.93s  |      56.148805  | NaN              | 🟢 Pratyaksh Stable\n 070  | 1.96s  |      59.056164  | NaN              | 🟢 Pratyaksh Stable\n 071  | 1.99s  |      62.114925  | NaN              | 🟢 Pratyaksh Stable\n 072  | 2.02s  |      65.332971  | NaN              | 🟢 Pratyaksh Stable\n 073  | 2.04s  |      68.718598  | NaN              | 🟢 Pratyaksh Stable\n 074  | 2.07s  |      72.280531  | NaN              | 🟢 Pratyaksh Stable\n 075  | 2.10s  |      76.027953  | NaN              | 🟢 Pratyaksh Stable\n 076  | 2.13s  |      79.970522  | NaN              | 🟢 Pratyaksh Stable\n 077  | 2.16s  |      84.118402  | NaN              | 🟢 Pratyaksh Stable\n 078  | 2.18s  |      88.482282  | NaN              | 🟢 Pratyaksh Stable\n 079  | 2.21s  |      93.073412  | NaN              | 🟢 Pratyaksh Stable\n 080  | 2.24s  |      97.903626  | NaN              | 🟢 Pratyaksh Stable\n 081  | 2.27s  |     102.985374  | NaN              | 🟢 Pratyaksh Stable\n 082  | 2.30s  |     108.331754  | NaN              | 🟢 Pratyaksh Stable\n 083  | 2.32s  |     113.956547  | NaN              | 🟢 Pratyaksh Stable\n 084  | 2.35s  |     119.874252  | NaN              | 🟢 Pratyaksh Stable\n 085  | 2.38s  |     126.100122  | NaN              | 🟢 Pratyaksh Stable\n 086  | 2.41s  |     132.650204  | NaN              | 🟢 Pratyaksh Stable\n 087  | 2.44s  |     139.541382  | NaN              | 🟢 Pratyaksh Stable\n 088  | 2.46s  |     146.791419  | NaN              | 🟢 Pratyaksh Stable\n 089  | 2.49s  |     154.419002  | NaN              | 🟢 Pratyaksh Stable\n 090  | 2.52s  |     162.443792  | NaN              | 🟢 Pratyaksh Stable\n 091  | 2.55s  |     170.886473  | NaN              | 🟢 Pratyaksh Stable\n 092  | 2.58s  |     179.768807  | NaN              | 🟢 Pratyaksh Stable\n 093  | 2.60s  |     189.113689  | NaN              | 🟢 Pratyaksh Stable\n 094  | 2.63s  |     198.945206  | NaN              | 🟢 Pratyaksh Stable\n 095  | 2.66s  |     209.288699  | NaN              | 🟢 Pratyaksh Stable\n 096  | 2.69s  |     220.170830  | NaN              | 🟢 Pratyaksh Stable\n 097  | 2.72s  |     231.619648  | NaN              | 🟢 Pratyaksh Stable\n 098  | 2.74s  |     243.664664  | NaN              | 🟢 Pratyaksh Stable\n 099  | 2.77s  |     256.336924  | NaN              | 🟢 Pratyaksh Stable\n 100  | 2.80s  |     269.669092  | NaN              | 🟢 Pratyaksh Stable\n 101  | 2.83s  |     283.695533  | NaN              | 🟢 Pratyaksh Stable\n 102  | 2.86s  |     298.452401  | NaN              | 🟢 Pratyaksh Stable\n 103  | 2.88s  |     313.977732  | NaN              | 🟢 Pratyaksh Stable\n 104  | 2.91s  |     330.311546  | NaN              | 🟢 Pratyaksh Stable\n 105  | 2.94s  |     347.495943  | NaN              | 🟢 Pratyaksh Stable\n 106  | 2.97s  |     365.575217  | NaN              | 🟢 Pratyaksh Stable\n 107  | 3.00s  |     384.595969  | NaN              | 🟢 Pratyaksh Stable\n 108  | 3.02s  |     404.607226  | NaN              | 🟢 Pratyaksh Stable\n 109  | 3.05s  |     425.660570  | NaN              | 🟢 Pratyaksh Stable\n 110  | 3.08s  |     447.810266  | NaN              | 🟢 Pratyaksh Stable\n 111  | 3.11s  |     471.113407  | NaN              | 🟢 Pratyaksh Stable\n 112  | 3.14s  |     495.630059  | NaN              | 🟢 Pratyaksh Stable\n 113  | 3.16s  |     521.423415  | NaN              | 🟢 Pratyaksh Stable\n 114  | 3.19s  |     548.559960  | NaN              | 🟢 Pratyaksh Stable\n 115  | 3.22s  |     577.109640  | NaN              | 🟢 Pratyaksh Stable\n 116  | 3.25s  |     607.146043  | NaN              | 🟢 Pratyaksh Stable\n 117  | 3.28s  |     638.746592  | NaN              | 🟢 Pratyaksh Stable\n 118  | 3.30s  |     671.992738  | NaN              | 🟢 Pratyaksh Stable\n 119  | 3.33s  |     706.970176  | NaN              | 🟢 Pratyaksh Stable\n 120  | 3.36s  |     743.769064  | NaN              | 🟢 Pratyaksh Stable\n========================================================================\nFATAL ERROR: Classical RK4 suffered NaN overflow.\nSUCCESS: The Pratyaksh Framework autonomously damped the shock.\n```\n\nThe Pratyaksh Integrator uses only basic operations (addition, multiplication, and a single differentiable vector-norm division). This means you can use **Direct Autograd** (backprop-through-time) without custom implicit differentiation rules.\n\nIf memory is a bottleneck, you can plug the Pratyaksh Integrator directly into the  **$O(1)$ Adjoint Method** to integrate backward explicitly, bypassing the \n\nThe entire solver is contained in a single self-contained C++20 header file: [`pratyaksh.hpp`](https://github.com/Pratyaksh3142/The-Pratyaksh-Framework/blob/main/pratyaksh.hpp).\n\n```\n#include \"pratyaksh.hpp\"\n#include <iostream>\n#include <vector>\n\nvoid harmonic_oscillator(double t, const std::vector<double>& y, std::vector<double>& dy) {\n    dy[0] = y[1];\n    dy[1] = -y[0];\n}\n\nint main() {\n    std::vector<double> y = {1.0, 0.0}; // position = 1, velocity = 0\n    std::vector<double> k1(2), k2(2), k3(2), k4(2), temp(2);\n    double dt = 0.01;\n    double t = 0.0;\n\n    // Advance one step with Formula B (Order 4)\n    auto result = pratyaksh::step_formula_b(t, dt, y, k1, k2, k3, k4, temp, harmonic_oscillator);\n\n    std::cout << \"y(0.01) = \" << y[0] << \", Denominator = \" << result.denominator << \"\\n\";\n    return 0;\n}\n```\n\nThe benchmark suite in `benchmarks/` reproduces the exact numerical results published in Section 5 of the paper:\n\n```\n# 1. Asymptotic Convergence Order (Section 5.1: p = 2.000 and p = 4.000)\nclang++ -std=c++20 -O3 benchmarks/test_convergence.cpp -o test_convergence\n./test_convergence\n\n# 2. Kuramoto-Sivashinsky 4th-Order PDE: CFL Tracking (Section 5.2: dt_crit = 0.004306 s)\nclang++ -std=c++20 -O3 benchmarks/test_ks.cpp -o test_ks\n./test_ks\n\n# 3. Burgers' Shockwave: Strict TVD Verification (Section 5.3: 0 TV increases)\nclang++ -std=c++20 -O3 benchmarks/test_burgers.cpp -o test_burgers\n./test_burgers\n\n# 4. 2,000-Dimensional Brusselator Reaction-Diffusion PDE (Section 5.4: 2.88x beyond RK4 limit)\nclang++ -std=c++20 -O3 benchmarks/test_brusselator.cpp -o test_brusselator\n./test_brusselator\n\n# 5. Symbolic CAS Taylor Derivation (Section 3)\npython3 verify_derivation.py\nThe-Pratyaksh-Framework/\n├── pratyaksh.hpp                   # Production single-header C++20 framework\n├── verify_derivation.py            # SymPy CAS verification of Taylor series\n├── benchmarks/\n│   ├── test_convergence.cpp       # Section 5.1 step-halving order test\n│   ├── test_ks.cpp                # Section 5.2 Kuramoto-Sivashinsky CFL test\n│   ├── test_burgers.cpp           # Section 5.3 Burgers TVD shock preservation test\n│   └── test_brusselator.cpp       # Section 5.4 2,000-D Brusselator wave test\n├── paper.tex                       # Complete LaTeX manuscript\n├── LICENSE                         # Academic & Non-Commercial Research License\n└── README.md                       # Documentation & Quickstart\n```\n\nIf you utilize the Pratyaksh Framework in scientific research, please cite:\n\n```\n@article{raj2026pratyaksh,\n  title={The Pratyaksh Framework: A Self-Limiting TVD Explicit Runge-Kutta Family for Real-Time Physics, Robotics, and Scientific Computing},\n  author={Raj, Pratyaksh},\n  journal={Zenodo Preprints},\n  year={2026},\n  doi={10.5281/zenodo.23012055},\n  url={https://doi.org/10.5281/zenodo.23012055}\n}\n```\n\nCopyright (c) 2026 Pratyaksh Raj. All rights reserved.\n\nThe Pratyaksh Framework is provided free for academic research and personal non-commercial evaluation under the terms of the [`LICENSE`](https://github.com/Pratyaksh3142/The-Pratyaksh-Framework/blob/main/LICENSE). Commercial deployment in game physics engines, commercial simulators, or closed-source enterprise software requires a commercial license. For commercial licensing inquiries, contact `pratyakshnarayanlal1@gmail.com`.", "url": "https://wpnews.pro/news/show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes", "canonical_source": "https://github.com/Pratyaksh3142/The-Pratyaksh-Framework", "published_at": "2026-09-28 14:09:56+00:00", "updated_at": "2026-09-28 14:19:36.215234+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "neural-networks"], "entities": ["Pratyaksh Raj", "Pratyaksh Framework", "arXiv", "RK4", "DOPRI5", "BDF", "Neural ODEs"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes", "markdown": "https://wpnews.pro/news/show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes.md", "text": "https://wpnews.pro/news/show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes.txt", "jsonld": "https://wpnews.pro/news/show-hn-a-nan-immune-explicit-ode-solver-that-survives-where-rk4-explodes.jsonld"}}