Math DE, Calculus & Algebra (Brainstorm Phases)
This document describes the differential-equation, calculus, and algebra stack
added for the DE / MathNN / DE-kernel brainstorm: named ODE catalog, PINN bridge,
index-1 DAE lite, domain twins, and extended linear algebra / calculus kernels.
Related: MathNN.md (MathNN.md) · ScientificComputingLua.md (ScientificComputingLua.md) ·
LifeRL.md (LifeRL.md) · SpaceEngineersRL.md (SpaceEngineersRL.md)
Goals (all phases)
| Phase | Deliverable | Status |
| 1 | ODE/SDE/PDE model catalog + MathODE expansions | Shipped |
| 2 | Algebra: expm, LSQ, Lyapunov, Sturm, Markov, nullspace | Shipped |
| 3 | Calculus: sensitivity, Fourier, Padé, directional, mixed, Green | Shipped |
| 4 | PINN bridge + DAE lite + domain twins | Shipped |
| 5 | Commands, vcxproj, docs | Shipped |
True GPU DE kernels, full collocation PINNs with automatic differentiation through
MathNN, and high-index DAE solvers remain deferred (CPU hybrid MVP first).
Core files
| File | Role |
| MathODE.hpp / .cpp | RK4, RK45, Euler–Maruyama SDE, linear y’=Ay, sensitivity |
| MathODECatalog.hpp / .cpp | Named models, twins, residual, SDE demos |
| MathPINNBridge.hpp / .cpp | Catalog residual + 1D dense residual+data fit |
| MathDAE.hpp / .cpp | Semi-explicit mass-matrix index-1 DAE lite |
| MathDEFeatures.hpp / .cpp | User de command surface |
| MathCalculus.hpp / .cpp | _CalcKernel (diff, integral, Fourier, Padé, Green, …) |
| MathCalcFeatures.hpp / .cpp | User calc commands + expression parser |
| MathAlgebra.hpp / .cpp | _AlgebraKernel (LA, expm, LSQ, Sturm, Markov, …) |
| MathAlgebraFeatures.hpp / .cpp | User algebra commands |
Commands
Differential equations (de)
de status
de catalog list
de catalog describe decay
de catalog run logistic [t1] [dt]
de catalog residual decay
de catalog sde gbm|ou [t1]
de catalog twin focus|burnout|se
de pinn fit decay [steps]
de pinn residual logistic
de dae demo|rc
de dae alg
de linear [t]
de sensitivity [k]
de solve
de rsi | drives | queue | trust | sir
Calculus (calc)
calc demo
calc diff <expr> <x>
calc integrate <expr> <a> <b>
calc root|min|optimize|taylor|gradient …
calc fourier <expr> [period] [n_terms]
calc fourier_sin <expr> …
calc pade <expr> [x0] [m] [k]
calc improper <expr> [a] # ∫_a^∞
calc directional [x y ux uy]
calc mixed [x y]
calc laplacian|hessian [x y]
calc green [x0 y0 x1 y1]
calc line [ax ay bx by]
calc sensitivity [a]
Expressions use x, + – * / ^, sin cos tan exp log sqrt abs, pi, e.
Algebra (algebra)
algebra demo
algebra quad|roots|system2|eig|binomial|geo|conic|interest|ineq …
algebra expm [a11 a12 a21 a22]
algebra lsq
algebra lyapunov
algebra gcd | sturm | markov | nullspace | cond
Model catalog
Categories: teaching, chaotic, epidemic, control, ai_twin, stochastic, pde_proxy.
Notable models:
- Teaching: decay, logistic, harmonic, riccati, bernoulli, pendulum, linear2, brusselator
- Chaotic: vanderpol, duffing, lorenz, rossler
- Epidemic / control: sir, lotka
- AI twins: focus_twin, burnout_twin, se_power (LifeRL / SE power sketches)
- Stochastic: gbm, ou (drift ODE + de catalog sde for Euler–Maruyama)
- PDE proxy: heat1d (2-cell discrete heat)
PINN bridge
de pinn fit <model> [steps] trains a small MathNN dense net u_θ(t) with:
- Data loss — match catalog RK trajectory samples
- Residual loss — finite-difference u_t vs catalog f(t,u)
Checkpoints go under checkpoints/pinn_<model>.net. This is a lite residual
bridge, not a full multi-D collocation PINN with automatic differentiation of
the ODE residual through all layers.
de pinn residual <model> reports catalog trajectory residual RMS (collocation
check without NN).
DAE lite
Semi-explicit form: diagonal mass matrix M. Zero mass entries are treated as
algebraic constraints and projected with a short damped Newton-like update.
- de dae demo — RC discharge ODE as DAE path
- de dae alg — algebraic constraint demo y0’=y1, 0=y0+y1-1
MathODE expansions
- LinearStep / LinearIntegrate — dense y’ = A y
- IntegrateSensitivity — simultaneous state + dy/dp via FD Jacobian
- Existing: RK4, adaptive RK45, Euler–Maruyama, Newton helpers
Algebra / calculus kernels
Algebra: LeastSquares, ConditionEstimate, MatrixExp, SolveLyapunov,
PolyGcd, Sturm root count, MarkovStationary, NullspaceBasis, MatMul /
Transpose / Identity.
Calculus: MixedPartial, ImproperIntegralTail, Fourier cos/sin coeffs,
PadeApproximant, LineIntegral, GreenTheoremCheck2D, plus existing gradient /
Hessian / Laplacian / directional derivative.
Lua
Existing bindings remain:
- ai_de_status, ai_de_rsi_observe
- ai_calc_eval, ai_calc_integrate, ai_calc_diff
- ai_algebra_quadratic, ai_algebra_roots
Build
Units are in _AugmentedIntelligence.vcxproj:
- MathODECatalog.cpp, MathPINNBridge.cpp, MathDAE.cpp
- plus existing MathODE, MathCalculus, MathAlgebra, feature front-ends
No extra preprocessor flags are required for the DE/calc/algebra MVP.
Deferred
- Full CUDA/OpenCL DE integrators and spectral PDE solvers
- True automatic-diff PINNs multi-D + boundary loss
- High-index DAE (Pantelides / dummy derivatives)
- Symbolic algebra / CAS
- Production control LQR from SolveLyapunov / Riccati plant catalog
Quick smoke checklist
- de catalog list — shows models including twins + gbm/ou
- de catalog run decay 2 — final state near e^{-2}
- de catalog sde gbm 1 — stochastic path
- de pinn residual decay — finite residual
- de dae demo — RC discharge
- calc demo — extended Fourier / Padé / Green lines
- algebra expm / algebra lyapunov / algebra sturm
Filed under: Uncategorized - @ July 18, 2026 6:41 am