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 · ScientificComputingLua.md · LifeRL.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 |
| 6 | Multi-D PDE FD (MathPDE: heat2d, wave2d, poisson2d) |
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 |
MathPDE.hpp / .cpp |
2D heat / wave / Poisson finite-difference multi-D MVP |
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
de pde status|demo|heat|wave|poisson|residual
de pde heat [nx] [ny] [k] [t]
de pde wave [nx] [ny] [c] [t]
de pde poisson [nx] [ny] [iters]
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 sdefor 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_tvs catalogf(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 pathde dae alg— algebraic constraint demoy0'=y1,0=y0+y1-1
MathODE expansions
LinearStep/LinearIntegrate— densey' = A yIntegrateSensitivity— simultaneous state +dy/dpvia 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_observeai_calc_eval,ai_calc_integrate,ai_calc_diffai_algebra_quadratic,ai_algebra_roots
Build
Units are in _AugmentedIntelligence.vcxproj:
MathODECatalog.cpp,MathPINNBridge.cpp,MathDAE.cpp,MathPDE.cpp- plus existing
MathODE,MathCalculus,MathAlgebra, feature front-ends
No extra preprocessor flags are required for the DE/calc/algebra MVP.
Multi-D PDE (MathPDE)
CPU finite-difference MVP for the multi-D DE integration brainstorm:
| Solver | Scheme | Notes |
|---|---|---|
heat2d |
Explicit FTCS | CFL-limited; Gaussian IC, Dirichlet 0 edges |
wave2d |
Leapfrog | CFL-limited; energy proxy Σ u² |
poisson2d |
Gauss–Seidel | Manufactured solution sin(πx)sin(πy) + L2 error |
ASCII heat-maps print after each run. Residual RMS supports PINN-style collocation checks without full AD.
Deferred
- Full CUDA/OpenCL DE integrators and spectral PDE solvers
- True automatic-diff PINNs multi-D + boundary loss through MathNN layers
- 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/oude catalog run decay 2— final state neare^{-2}de catalog sde gbm 1— stochastic pathde pinn residual decay— finite residualde dae demo— RC dischargecalc demo— extended Fourier / Padé / Green linesalgebra expm/algebra lyapunov/algebra sturmde pde demo— heat2d + wave2d + poisson2d one-linersde pde heat 32 32 0.2 0.5— ASCII cooling map