Lab 05 · Chapter 5

Matrix-Based Methods

Can an integral, a Laplace transform or a linear ODE be solved by one small linear system instead of repeated integration by parts?

On a function space closed under differentiation, d/dxd/dx is a constant matrix Ω\Omega with Φ′=ΩΦ\Phi'=\Omega\Phi. The Matrix Boundary Method turns ∫0aebxf(x) dx\int_0^a e^{bx}f(x)\,dx into one solve with bI+ΩTbI+\Omega^{\mathsf T} and two boundary evaluations; the same resolvent gives Laplace transforms with the boundary vector Φ(0)\Phi(0), products through Kronecker sums, and particular solutions of constant-coefficient ODEs. Matrices are exact rationals; every result is checked against quadrature, direct differentiation and sympy.

What the book proves

Theory

Conventions used everywhere on this page

  • Column of basis functions Φ(x)=(φ1,…,φn)T\Phi(x)=(\varphi_1,\dots,\varphi_n)^{\mathsf T}, coefficient vector uu, f(x)=uTΦ(x)f(x)=u^{\mathsf T}\Phi(x).
  • Differentiation matrix Ω\Omega with Φ′(x)=Ω Φ(x)\Phi'(x)=\Omega\,\Phi(x): row ii of Ω\Omega holds the coefficients of φi′\varphi_i'. Because uu multiplies Φ\Phi from the left, every linear system acts with the transpose: f′=(ΩTu)TΦf'=(\Omega^{\mathsf T}u)^{\mathsf T}\Phi and the MBM system is (bI+ΩT)z=u(bI+\Omega^{\mathsf T})z=u.
  • Weights: the MBM integral uses ebxe^{bx}; the exponential-matrix formula (Prop. 5.3.1) and the Laplace transform use e−bxe^{-bx}, e−sxe^{-sx}. They agree after b↦−bb\mapsto -b.
  • All parameters are real; the Laplace formulas hold for complex ss in the same region.

1. Linear spaces of functions

§5.1–5.1.5

Space, combination, span

A linear space of functions is closed under addition and scalar multiplication: f,g∈V⇒f+g∈V, af∈Vf,g\in V\Rightarrow f+g\in V,\ af\in V. It is not required to be closed under products: in V=span⁡{1,x}V=\operatorname{span}\{1,x\}, (1+x)2(1+x)^2 needs x2x^2.

span⁡{φ1,…,φn}={a1φ1+⋯+anφn: ai∈R}\operatorname{span}\{\varphi_1,\dots,\varphi_n\}=\{a_1\varphi_1+\dots+a_n\varphi_n:\ a_i\in\mathbb R\}

The set {sin⁡x,cos⁡x}\{\sin x,\cos x\} alone is not a linear space; its span {asin⁡x+bcos⁡x}\{a\sin x+b\cos x\} is.

§5.1.6–5.1.9

Independence, basis, dimension

a1φ1(x)+⋯+anφn(x)=0  ∀x ⟹ a1=⋯=an=0a_1\varphi_1(x)+\dots+a_n\varphi_n(x)=0\ \ \forall x\ \Longrightarrow\ a_1=\dots=a_n=0

A basis spans VV and is independent; dim⁡V\dim V is its size: dim⁡span⁡{sin⁡x,cos⁡x}=2\dim\operatorname{span}\{\sin x,\cos x\}=2, dim⁡span⁡{1,x,x2}=3\dim\operatorname{span}\{1,x,x^2\}=3. All polynomials form an infinite-dimensional space.

§5.1.10

Closure under differentiation

f∈V ⟹ f′∈Vf\in V\ \Longrightarrow\ f'\in V

span⁡{sin⁡x,cos⁡x}\operatorname{span}\{\sin x,\cos x\} is closed; W=span⁡{x}W=\operatorname{span}\{x\} is not, since (x)′=1∉W(x)'=1\notin W. On a closed space, d/dxd/dx is a linear map of the space into itself — the key to everything below.

2. The MBM representation

§5.2.1–5.2.2

Coordinates and the differentiation matrix

f(x)=uTΦ(x),φi′(x)=∑j=1nΩijφj(x) ⟺ Φ′(x)=Ω Φ(x)f(x)=u^{\mathsf T}\Phi(x),\qquad \varphi_i'(x)=\sum_{j=1}^n\Omega_{ij}\varphi_j(x)\ \Longleftrightarrow\ \Phi'(x)=\Omega\,\Phi(x)

Book example: Φ=(sin⁡x,cos⁡x)T\Phi=(\sin x,\cos x)^{\mathsf T} gives Φ′=(cos⁡x,−sin⁡x)T\Phi'=(\cos x,-\sin x)^{\mathsf T}, so Ω=(01−10)\Omega=\begin{pmatrix}0&1\\-1&0\end{pmatrix}.

§5.2.3–5.2.7

Ansatz and matching

For ∫ebxf(x) dx\int e^{bx}f(x)\,dx try F(x)=ebxΦ(x)TzF(x)=e^{bx}\Phi(x)^{\mathsf T}z. Since (ΦT)′=(ΩΦ)T=ΦTΩT(\Phi^{\mathsf T})'=(\Omega\Phi)^{\mathsf T}=\Phi^{\mathsf T}\Omega^{\mathsf T},

F′(x)=ebxΦ(x)T(bI+ΩT)z=!ebxΦ(x)Tu ⟸ (bI+ΩT)z=u.F'(x)=e^{bx}\Phi(x)^{\mathsf T}(bI+\Omega^{\mathsf T})z\overset{!}{=}e^{bx}\Phi(x)^{\mathsf T}u\ \Longleftarrow\ (bI+\Omega^{\mathsf T})z=u .

Linear independence of the basis makes the matching condition also necessary.

§5.2.7

MBM boundary formula

If det⁡(bI+ΩT)≠0\det(bI+\Omega^{\mathsf T})\neq0,

∫ebxf(x) dx=ebxΦ(x)T(bI+ΩT)−1u+C,∫0aebxf(x) dx=[ebxΦ(x)T(bI+ΩT)−1u]0a.\int e^{bx}f(x)\,dx=e^{bx}\Phi(x)^{\mathsf T}(bI+\Omega^{\mathsf T})^{-1}u+C,\qquad \int_0^a e^{bx}f(x)\,dx=\Big[e^{bx}\Phi(x)^{\mathsf T}(bI+\Omega^{\mathsf T})^{-1}u\Big]_0^a .

3. Operator interpretation: algebraic particular inverse versus causal inverse

§5.2.8, Steps 1–4

Causal inverse of D + b

For y′+by=fy'+by=f, the integrating factor gives the causal solution with y(0)=0y(0)=0:

(D+b)−1f(x):=e−bx ⁣∫0xebsf(s) ds=∫0xe−b(x−s)f(s) ds,∫0aebxf(x) dx=[ebx(D+b)−1f(x)]0a.(D+b)^{-1}f(x):=e^{-bx}\!\int_0^x e^{bs}f(s)\,ds=\int_0^x e^{-b(x-s)}f(s)\,ds,\qquad \int_0^a e^{bx}f(x)\,dx=\Big[e^{bx}(D+b)^{-1}f(x)\Big]_0^a .

The causal inverse generally does not map the finite-dimensional space V back into V.

§5.2.8, Steps 5–8

Algebraic particular solution in V

yp(x)=Φ(x)T(bI+ΩT)−1usolves (D+b)yp=f inside V,yc(x)=yp(x)−e−bxyp(0).y_p(x)=\Phi(x)^{\mathsf T}(bI+\Omega^{\mathsf T})^{-1}u\quad\text{solves }(D+b)y_p=f\text{ inside }V,\qquad y_c(x)=y_p(x)-e^{-bx}y_p(0).

So (bI+ΩT)−1(bI+\Omega^{\mathsf T})^{-1} is the algebraic map to a particular solution on VV, not by itself the causal inverse; the boundary subtraction in the MBM formula supplies the endpoint condition. Book example on V=span⁡{1}V=\operatorname{span}\{1\}, b≠0b\neq0: algebraic 1/b1/b, causal (1−e−bx)/b(1-e^{-bx})/b.

§5.2.9

Laws and recipe

Linearity: if f=∑jcjfjf=\sum_j c_jf_j, fj=ujTΦf_j=u_j^{\mathsf T}\Phi, then ∫0aebxf dx=∑jcj[ebxΦTM(b)uj]0a\int_0^a e^{bx}f\,dx=\sum_j c_j\big[e^{bx}\Phi^{\mathsf T}M(b)u_j\big]_0^a.

  1. Choose Φ\Phi spanning ff; write f=uTΦf=u^{\mathsf T}\Phi.
  2. Build Ω\Omega with Φ′=ΩΦ\Phi'=\Omega\Phi.
  3. Invert once: M(b)=(bI+ΩT)−1M(b)=(bI+\Omega^{\mathsf T})^{-1}.
  4. Form F(x)=ebxΦ(x)TM(b)uF(x)=e^{bx}\Phi(x)^{\mathsf T}M(b)u.
  5. Evaluate ∫0aebxf dx=F(a)−F(0)\int_0^a e^{bx}f\,dx=F(a)-F(0).

4. Canonical bases and ready matrices

§5.2.10 Canonical bases and ready matrices, p. 144. Every entry below is reproduced exactly by the calculators (step 5 of the integral mode).

Basis Φ(x)Ω (Φ′ = ΩΦ)M(b) = (bI + Ωᵀ)⁻¹Singular when
(cos⁡ωx, sin⁡ωx)(\cos\omega x,\ \sin\omega x)ω(0−110)\omega\begin{pmatrix}0&-1\\1&0\end{pmatrix}M∘(b,ω)=1b2+ω2(b−ωωb)M_\circ(b,\omega)=\frac{1}{b^2+\omega^2}\begin{pmatrix}b&-\omega\\ \omega&b\end{pmatrix}b=ω=0b=\omega=0 (never for a basis)
(1, x, x2)(1,\ x,\ x^2)ΩT=(010002000)\Omega^{\mathsf T}=\begin{pmatrix}0&1&0\\0&0&2\\0&0&0\end{pmatrix}(1b−1b22b301b−2b2001b)\begin{pmatrix}\frac1b&-\frac1{b^2}&\frac2{b^3}\\0&\frac1b&-\frac2{b^2}\\0&0&\frac1b\end{pmatrix}b=0b=0
(eαxcos⁡ωx, eαxsin⁡ωx)(e^{\alpha x}\cos\omega x,\ e^{\alpha x}\sin\omega x)(α−ωωα)\begin{pmatrix}\alpha&-\omega\\ \omega&\alpha\end{pmatrix}1(b+α)2+ω2(b+α−ωωb+α)\frac{1}{(b+\alpha)^2+\omega^2}\begin{pmatrix}b+\alpha&-\omega\\ \omega&b+\alpha\end{pmatrix}b+α=ω=0b+\alpha=\omega=0
(eαxcosh⁡ωx, eαxsinh⁡ωx)(e^{\alpha x}\cosh\omega x,\ e^{\alpha x}\sinh\omega x)(αωωα)\begin{pmatrix}\alpha&\omega\\ \omega&\alpha\end{pmatrix}1(b+α)2−ω2(b+α−ω−ωb+α)\frac{1}{(b+\alpha)^2-\omega^2}\begin{pmatrix}b+\alpha&-\omega\\ -\omega&b+\alpha\end{pmatrix}(b+α)2=ω2(b+\alpha)^2=\omega^2 (Remark 13)
(eαx)(e^{\alpha x}) (Example 5.4)(α)(\alpha)1b+α\frac{1}{b+\alpha}b=−αb=-\alpha
(cos⁡,sin⁡,xcos⁡,xsin⁡)(ωx)(\cos,\sin,x\cos,x\sin)(\omega x) (§5.3.3)(0−ω00ω000100−ω01ω0)\begin{pmatrix}0&-\omega&0&0\\ \omega&0&0&0\\1&0&0&-\omega\\0&1&\omega&0\end{pmatrix}block triangular, Remark 14b=ω=0b=\omega=0

§5.2.11

Shift property

∫0aebxeαxg(x) dx=∫0ae(b+α)xg(x) dx⟺M(b)⟶M(b+α).\int_0^a e^{bx}e^{\alpha x}g(x)\,dx=\int_0^a e^{(b+\alpha)x}g(x)\,dx\quad\Longleftrightarrow\quad M(b)\longrightarrow M(b+\alpha).

For the exp–trig basis this is ∫0aebxeαx(ucos⁡ωx+vsin⁡ωx) dx=[ebxΦ(x)TM∘(b+α,ω)(u,v)T]0a\int_0^a e^{bx}e^{\alpha x}(u\cos\omega x+v\sin\omega x)\,dx=\big[e^{bx}\Phi(x)^{\mathsf T}M_\circ(b+\alpha,\omega)(u,v)^{\mathsf T}\big]_0^a, and likewise for exp–hyp with (b+α)2≠ω2(b+\alpha)^2\neq\omega^2.

Remark 14

Block-triangular inversion

M=(AB0A), A invertible ⟹ M−1=(A−1−A−1BA−10A−1).M=\begin{pmatrix}A&B\\0&A\end{pmatrix},\ A\text{ invertible}\ \Longrightarrow\ M^{-1}=\begin{pmatrix}A^{-1}&-A^{-1}BA^{-1}\\0&A^{-1}\end{pmatrix}.

Used to read selected components of (bI+ΩT)−1(bI+\Omega^{\mathsf T})^{-1} for the xkx^k-trig blocks.

after Example 5.4

Polynomial diagonal rule

For {1,x,…,xn}\{1,x,\dots,x^n\}, M(t)=(tI+ΩT)−1M(t)=(tI+\Omega^{\mathsf T})^{-1} is upper triangular with

Mi,i+k=(−1)k(i)kk! L{xk}=(−1)k (i)k 1tk+1,(i)k=i(i+1)⋯(i+k−1).M_{i,i+k}=(-1)^k\frac{(i)_k}{k!}\,\mathcal L\{x^k\}=(-1)^k\,(i)_k\,\frac{1}{t^{k+1}},\qquad (i)_k=i(i+1)\cdots(i+k-1).

No further factorial: the k!k! of L{xk}=k!/tk+1\mathcal L\{x^k\}=k!/t^{k+1} is cancelled by the 1/k!1/k!.

5. Products: Kronecker-state MBM

§5.3.1

Joint state and joint resolvent

If Φf′=ΩfΦf\Phi_f'=\Omega_f\Phi_f, Φg′=ΩgΦg\Phi_g'=\Omega_g\Phi_g, f=uTΦff=u^{\mathsf T}\Phi_f, G=vTΦgG=v^{\mathsf T}\Phi_g:

Ψ=Φg⊗Φf,Ψ′=[(Ωg⊗I)+(I⊗Ωf)]Ψ,w=v⊗u,fG=wTΨ,\Psi=\Phi_g\otimes\Phi_f,\quad \Psi'=\big[(\Omega_g\otimes I)+(I\otimes\Omega_f)\big]\Psi,\quad w=v\otimes u,\quad fG=w^{\mathsf T}\Psi,
∫0aebxf(x)G(x) dx=[ebxΨ(x)TM⊗(b) w]0a,M⊗(b)=(bI+ΩgT⊗I+I⊗ΩfT)−1.\int_0^a e^{bx}f(x)G(x)\,dx=\Big[e^{bx}\Psi(x)^{\mathsf T}M_\otimes(b)\,w\Big]_0^a,\qquad M_\otimes(b)=\big(bI+\Omega_g^{\mathsf T}\otimes I+I\otimes\Omega_f^{\mathsf T}\big)^{-1}.

Since (A⊗B)T=AT⊗BT(A\otimes B)^{\mathsf T}=A^{\mathsf T}\otimes B^{\mathsf T}, the joint matrix is bI+Ω⊗TbI+\Omega_\otimes^{\mathsf T} — the same transpose rule as for one basis. In practice solve (bI+ΩgT⊗I+I⊗ΩfT)z=w(bI+\Omega_g^{\mathsf T}\otimes I+I\otimes\Omega_f^{\mathsf T})z=w.

§5.3.2, §5.3.4

When it applies

  1. Closure: both bases closed under differentiation with constant matrices.
  2. Invertibility: det⁡(bI+ΩgT⊗I+I⊗ΩfT)≠0\det(bI+\Omega_g^{\mathsf T}\otimes I+I\otimes\Omega_f^{\mathsf T})\neq0; resonant cases are handled by limits or decomposition (product-to-sum).
  3. Well-behaved endpoints: the boundary primitive is finite on [0,a][0,a].

Non-closed functions (e.g. sinc) must first be expanded into a closed basis.

6. Exponential-matrix variant and the Laplace transform

Remark 15, §5.3.5

State evolution

Φ′(x)=ΩΦ(x) ⟹ Φ(x)=exΩΦ(0),exΩ=∑n=0∞xnΩnn!,ddxexΩ=ΩexΩ.\Phi'(x)=\Omega\Phi(x)\ \Longrightarrow\ \Phi(x)=e^{x\Omega}\Phi(0),\qquad e^{x\Omega}=\sum_{n=0}^\infty\frac{x^n\Omega^n}{n!},\quad \frac{d}{dx}e^{x\Omega}=\Omega e^{x\Omega}.

Prop. 5.3.1, §5.3.6

Exponential-matrix integral formula

For det⁡(bI−Ω)≠0\det(bI-\Omega)\neq0 and a≥0a\ge0:

I(b)=∫0ae−bxf(x) dx=uT(bI−Ω)−1(I−e−a(bI−Ω))Φ(0),I(b)=\int_0^a e^{-bx}f(x)\,dx=u^{\mathsf T}(bI-\Omega)^{-1}\big(I-e^{-a(bI-\Omega)}\big)\Phi(0),

using ∫0aexAdx=A−1(eaA−I)\int_0^a e^{xA}dx=A^{-1}(e^{aA}-I) with A=Ω−bIA=\Omega-bI.

Remark 16, Examples 5.3.2–5.4

Laplace limit

If Re⁡s\operatorname{Re}s is large enough that e−a(sI−Ω)→0e^{-a(sI-\Omega)}\to0 (i.e. Re⁡s>max⁡Re⁡λ(Ω)\operatorname{Re}s>\max\operatorname{Re}\lambda(\Omega)):

L{uTΦ}(s)=∫0∞e−sxf(x) dx=uT(sI−Ω)−1Φ(0)=Φ(0)T(sI−ΩT)−1u.\mathcal L\{u^{\mathsf T}\Phi\}(s)=\int_0^\infty e^{-sx}f(x)\,dx=u^{\mathsf T}(sI-\Omega)^{-1}\Phi(0)=\Phi(0)^{\mathsf T}(sI-\Omega^{\mathsf T})^{-1}u .

L{cos⁡ωx}=ss2+ω2\mathcal L\{\cos\omega x\}=\frac{s}{s^2+\omega^2}, L{sin⁡ωx}=ωs2+ω2\mathcal L\{\sin\omega x\}=\frac{\omega}{s^2+\omega^2} (Re⁡s>0\operatorname{Re}s>0), L{eαx}=1s−α\mathcal L\{e^{\alpha x}\}=\frac1{s-\alpha} (Re⁡s>α\operatorname{Re}s>\alpha). The vector Φ(0)\Phi(0) is the boundary vector.

7. Linear ODEs via MBM

§5.3.7, eq. (5.1)

First order, from convolution to boundary

y′−by=f, y(0)=y0:y(x)=ebxy0+ebx[e−bsΦ(s)TM(−b) u]0x,M(−b)=(−bI+ΩT)−1.y'-by=f,\ y(0)=y_0:\qquad y(x)=e^{bx}y_0+e^{bx}\Big[e^{-bs}\Phi(s)^{\mathsf T}M(-b)\,u\Big]_0^x,\qquad M(-b)=(-bI+\Omega^{\mathsf T})^{-1}.

Second- and higher-order equations are handled via state-space form (or kernel splitting) with the same boundary principle.

§5.3.8

Ready kernels

Trig: M(β,t)=1β2+t2(β−ttβ),Exp–trig: M(β)=1(β+α)2+t2(β+α−ttβ+α),\text{Trig: }M(\beta,t)=\frac{1}{\beta^2+t^2}\begin{pmatrix}\beta&-t\\ t&\beta\end{pmatrix},\qquad \text{Exp–trig: }M(\beta)=\frac{1}{(\beta+\alpha)^2+t^2}\begin{pmatrix}\beta+\alpha&-t\\ t&\beta+\alpha\end{pmatrix},
Poly (deg⁡≤2): M(β)=(1β−1β22β301β−2β2001β).\text{Poly }(\deg\le2):\ M(\beta)=\begin{pmatrix}\frac1\beta&-\frac1{\beta^2}&\frac2{\beta^3}\\0&\frac1\beta&-\frac2{\beta^2}\\0&0&\frac1\beta\end{pmatrix}.

Compute

Interactive calculator

Loading the Matrix Boundary Method calculators… It runs entirely in your browser and needs JavaScript.

From the book

Worked examples

Every value in the tables below is recomputed by this page's engine (exact rational matrices, then floating-point boundary evaluation) and compared with the book's closed form or with adaptive quadrature.

§5.2.11

Example 5.2.1 — trig kernel, unified

∫0aebx(ucos⁡ωx+vsin⁡ωx)dx=eba((bu−ωv)cos⁡ωa+(ωu+bv)sin⁡ωa)−(bu−ωv)b2+ω2\int_0^a e^{bx}\big(u\cos\omega x+v\sin\omega x\big)dx=\frac{e^{ba}\big((bu-\omega v)\cos\omega a+(\omega u+bv)\sin\omega a\big)-(bu-\omega v)}{b^2+\omega^2}

via M∘(b,ω)(u,v)T=1b2+ω2(bu−ωv, ωu+bv)TM_\circ(b,\omega)(u,v)^{\mathsf T}=\frac{1}{b^2+\omega^2}(bu-\omega v,\ \omega u+bv)^{\mathsf T}. Check at u=2, v=−12, ω=75, b=910, a=115u=2,\ v=-\tfrac12,\ \omega=\tfrac75,\ b=\tfrac9{10},\ a=\tfrac{11}5:

QuantityLab (MBM)ReferenceVerdict
integral−7.048682675078−7.048682675078 (book closed form)Agree · 1.6 × 10⁻¹⁵
integral−7.048682675078−7.048682675078 (quadrature)Agree · 1.3 × 10⁻¹⁵

§5.2.11

Example 5.2.2 — polynomial x² − 2x (corrected final line)

M(b)u=(2b2+2b3−2b−2b21b),u=(0,−2,1)TM(b)u=\begin{pmatrix}\frac{2}{b^{2}} + \frac{2}{b^{3}} \\ -\frac{2}{b} - \frac{2}{b^{2}} \\ \frac{1}{b}\end{pmatrix},\qquad u=(0,-2,1)^{\mathsf T}
∫0aebx(x2−2x) dx=eba[a2b−(2b+2b2)a+2b2+2b3]−2b2−2b3(b≠0)\int_0^a e^{bx}(x^2-2x)\,dx=e^{ba}\Big[\frac{a^2}{b}-\Big(\frac2b+\frac2{b^2}\Big)a+\frac2{b^2}+\frac2{b^3}\Big]-\frac2{b^2}-\frac2{b^3}\qquad(b\neq0)

Valid for every b≠0b\neq0 (sympy confirms the identity symbolically). At a=b=1a=b=1: ∫01ex(x2−2x) dx=e−4\int_0^1e^{x}(x^2-2x)\,dx=e-4. The earlier edition's final line agreed with this only at b=1b = 1.

QuantityLab (MBM)ReferenceVerdict
a=b=1a=b=1−1.281718171541−1.281718171541 (e − 4)Agree · 0
b=32, a=2b=\tfrac32,\ a=2−7.432751680944−7.432751680945 (corrected formula)Agree · 2.5 × 10⁻¹⁵
b=−1, a=32b=-1,\ a=\tfrac32−0.502042860334−0.502042860334 (corrected formula)Agree · 0

§5.2.11

Shift property — exp–trig and exp–hyp

∫0aebx eαx(ucos⁡ωx+vsin⁡ωx)dx=[ebxΦ(x)TM∘(b+α,ω)(uv)]0a,Φ=(eαxcos⁡ωxeαxsin⁡ωx)\int_0^a e^{bx}\,e^{\alpha x}\big(u\cos\omega x+v\sin\omega x\big)dx=\Big[e^{bx}\Phi(x)^{\mathsf T}M_\circ(b+\alpha,\omega)\begin{pmatrix}u\\v\end{pmatrix}\Big]_0^a,\quad \Phi=\begin{pmatrix}e^{\alpha x}\cos\omega x\\ e^{\alpha x}\sin\omega x\end{pmatrix}

Reading note: the book's “Example 2 (Exp–Trig base)” writes f(x)=ucos⁡ωx+vsin⁡ωxf(x)=u\cos\omega x+v\sin\omega x next to a basis containing eαxe^{\alpha x}; the displayed boundary formula integrates ebxeαx(ucos⁡ωx+vsin⁡ωx)=ebx(u,v)Φ(x)e^{bx}e^{\alpha x}(u\cos\omega x+v\sin\omega x)=e^{bx}(u,v)\Phi(x), which is how it is used here.

QuantityLab (MBM)ReferenceVerdict
α=12, ω=2, (u,v)=(1,3), b=−1, a=32\alpha=\tfrac12,\ \omega=2,\ (u,v)=(1,3),\ b=-1,\ a=\tfrac322.2524672739872.252467273987 (quadrature)Agree · 2 × 10⁻¹⁶
exp–hyp: α=1, ω=12, (1,2), b=14, a=1\text{exp–hyp: }\alpha=1,\ \omega=\tfrac12,\ (1,2),\ b=\tfrac14,\ a=13.3307070445493.330707044549 (quadrature)Agree · 0

§5.3.3

x cos ωx without integration by parts

Φ=(cos⁡,sin⁡,xcos⁡,xsin⁡)(ωx)\Phi=(\cos,\sin,x\cos,x\sin)(\omega x), u=(0,0,1,0)Tu=(0,0,1,0)^{\mathsf T}, b=0b = 0: ΩTz=u\Omega^{\mathsf T}z=u gives z=(1/ω2,0,0,1/ω)Tz=(1/\omega^2,0,0,1/\omega)^{\mathsf T} and

∫0axcos⁡(ωx) dx=aωsin⁡(ωa)+cos⁡(ωa)−1ω2.\int_0^a x\cos(\omega x)\,dx=\frac{a}{\omega}\sin(\omega a)+\frac{\cos(\omega a)-1}{\omega^2}.
QuantityLab (MBM)ReferenceVerdict
ω=2, a=32\omega=2,\ a=\tfrac32−0.3916581181052−0.3916581181052 (book closed form)Agree · 0

§5.3.3

Example B — x² cos ωx (b = 0)

Six-state basis, z=(0,−2/ω3,2/ω2,0,0,1/ω)Tz=(0,-2/\omega^3,2/\omega^2,0,0,1/\omega)^{\mathsf T}, F(0)=0F(0)=0:

∫0ax2cos⁡(ωx) dx=2ω2acos⁡(ωa)−2ω3sin⁡(ωa)+1ωa2sin⁡(ωa).\int_0^a x^2\cos(\omega x)\,dx=\frac{2}{\omega^2}a\cos(\omega a)-\frac{2}{\omega^3}\sin(\omega a)+\frac1\omega a^2\sin(\omega a).
QuantityLab (MBM)ReferenceVerdict
ω=3, a=2\omega=3,\ a=20.074885796334850.07488579633485 (book closed form)Agree · 5.6 × 10⁻¹⁷

§5.3.3

Example C — eᵇˣ x cos ωx

c=bb2+ω2, d=ωb2+ω2, a0=ω2−b2(b2+ω2)2, b1=−2bω(b2+ω2)2c=\frac{b}{b^2+\omega^2},\ d=\frac{\omega}{b^2+\omega^2},\ a_0=\frac{\omega^2-b^2}{(b^2+\omega^2)^2},\ b_1=-\frac{2b\omega}{(b^2+\omega^2)^2}
∫0aebxxcos⁡(ωx) dx=eba(a0cos⁡ωa+b1sin⁡ωa+c acos⁡ωa+d asin⁡ωa)−a0\int_0^a e^{bx}x\cos(\omega x)\,dx=e^{ba}\big(a_0\cos\omega a+b_1\sin\omega a+c\,a\cos\omega a+d\,a\sin\omega a\big)-a_0

The book names the first constant a; it is written a₀ here to avoid a clash with the upper limit a.

QuantityLab (MBM)ReferenceVerdict
b=12, ω=2, a=32b=\tfrac12,\ \omega=2,\ a=\tfrac32−0.8347757315093−0.8347757315093 (book closed form)Agree · 2.2 × 10⁻¹⁶

Examples 5.3.2, 5.3, 5.4

Matrix-form Laplace transforms

L{f}(s)=uT(sI−Ω)−1Φ(0)\mathcal L\{f\}(s)=u^{\mathsf T}(sI-\Omega)^{-1}\Phi(0), computed symbolically by the lab:

L{cos⁡3x}=ss2+9,L{sin⁡3x}=3s2+9,L{e3x/2}=1s−32\mathcal L\{\cos 3x\}=\frac{s}{s^{2} + 9},\quad \mathcal L\{\sin 3x\}=\frac{3}{s^{2} + 9},\quad \mathcal L\{e^{3x/2}\}=\frac{1}{s - \frac{3}{2}}
QuantityLab (MBM)ReferenceVerdict
L{cos⁡3x}(2)\mathcal L\{\cos 3x\}(2)0.15384615384620.1538461538462 (s/(s²+ω²))Agree · 2.8 × 10⁻¹⁷
L{sin⁡3x}(2)\mathcal L\{\sin 3x\}(2)0.23076923076920.2307692307692 (ω/(s²+ω²))Agree · 2.8 × 10⁻¹⁷
L{e3x/2}(4)\mathcal L\{e^{3x/2}\}(4)0.40.4 (1/(s−α))Agree · 5.6 × 10⁻¹⁷

after Example 5.4

Diagonal–Laplace reading, n = 4

M=(1t−1t22t3−6t424t501t−2t26t3−24t4001t−3t212t30001t−4t200001t)M=\begin{pmatrix}\frac{1}{t} & -\frac{1}{t^{2}} & \frac{2}{t^{3}} & -\frac{6}{t^{4}} & \frac{24}{t^{5}} \\ 0 & \frac{1}{t} & -\frac{2}{t^{2}} & \frac{6}{t^{3}} & -\frac{24}{t^{4}} \\ 0 & 0 & \frac{1}{t} & -\frac{3}{t^{2}} & \frac{12}{t^{3}} \\ 0 & 0 & 0 & \frac{1}{t} & -\frac{4}{t^{2}} \\ 0 & 0 & 0 & 0 & \frac{1}{t}\end{pmatrix}

Reproduced exactly (and checked against the rational inverse of tI + Ωᵀ) in the “Polynomial diagonal rule” mode.

§5.2.8

Algebraic versus causal on span{1}

y′+2y=1y'+2y=1 (i.e. y′−(−2)y=1y'-(-2)y=1): algebraic particular solution yp=12y_p=\tfrac12 (inside V), causal solution yc=12(1−e−2x)y_c=\tfrac12(1-e^{-2x}) (outside V).

QuantityLab (MBM)ReferenceVerdict
yp(0.7)y_p(0.7)0.50.5 (1/b)Agree · 0
yc(0.7)y_c(0.7)0.37670151802920.3767015180292 ((1 − e^{−bx})/b)Agree · 0

First-order ODE examples (book §5.3.7 eq. 5.1 and the merged worked examples)

Equation, y(0) = 0Book solutionLab solution (exact coefficients)y(0.9): lab vs book vs quadrature
Example 1 (trig forcing)
y′−3y=cos⁡2xy'-3y=\cos 2x
y=313e3x−313cos⁡2x+213sin⁡2xy=\tfrac{3}{13}e^{3x}-\tfrac{3}{13}\cos 2x+\tfrac{2}{13}\sin 2xy=313 e3x−313 cos⁡(2x)+213 sin⁡(2x)y=\frac{3}{13}\,e^{3x} - \frac{3}{13}\,\cos(2x) + \frac{2}{13}\,\sin(2x)
w=M(−b)u=(−313, 213)Tw=M(-b)u=(-\frac{3}{13},\ \frac{2}{13})^{\mathsf T}
3.63603820927 · Agree · 2.4 × 10⁻¹⁶ · Agree · 0
Example 2 (exp–trig forcing)
y′+y=exsin⁡2xy'+y=e^{x}\sin 2x
y=14(ex(−cos⁡2x+sin⁡2x)+e−x)y=\tfrac14\big(e^{x}(-\cos 2x+\sin 2x)+e^{-x}\big)y=14 e−x−14 ex cos⁡(2x)+14 ex sin⁡(2x)y=\frac{1}{4}\,e^{-x} - \frac{1}{4}\,e^{x}\,\cos(2x) + \frac{1}{4}\,e^{x}\,\sin(2x)
w=M(−b)u=(−14, 14)Tw=M(-b)u=(-\frac{1}{4},\ \frac{1}{4})^{\mathsf T}
0.840168825352 · Agree · 1.1 × 10⁻¹⁶ · Agree · 0
Example 3 (polynomial forcing)
y′−2y=x2y'-2y=x^2
y=14e2x−(14+x2+x22)y=\tfrac14e^{2x}-\big(\tfrac14+\tfrac x2+\tfrac{x^2}2\big)y=14 e2x−14−12 x−12 x2y=\frac{1}{4}\,e^{2x} - \frac{1}{4} - \frac{1}{2}\,x - \frac{1}{2}\,x^{2}
w=M(−b)u=(−14, −12, −12)Tw=M(-b)u=(-\frac{1}{4},\ -\frac{1}{2},\ -\frac{1}{2})^{\mathsf T}
0.407411866103 · Agree · 0 · Agree · 1.1 × 10⁻¹⁶
Example 6 (exponential forcing)
y′−2y=e3xy'-2y=e^{3x}
y=e3x−e2xy=e^{3x}-e^{2x}y=−e2x+e3xy=-e^{2x} + e^{3x}
w=M(−b)u=(1)Tw=M(-b)u=(1)^{\mathsf T}
8.83008426046 · Agree · 0 · Agree · 4 × 10⁻¹⁶
Exercise 1
y′−4y=sin⁡3xy'-4y=\sin 3x
y=325e4x−325cos⁡3x−425sin⁡3xy=\tfrac{3}{25}e^{4x}-\tfrac{3}{25}\cos 3x-\tfrac{4}{25}\sin 3xy=325 e4x−325 cos⁡(3x)−425 sin⁡(3x)y=\frac{3}{25}\,e^{4x} - \frac{3}{25}\,\cos(3x) - \frac{4}{25}\,\sin(3x)
w=M(−b)u=(−325, −425)Tw=M(-b)u=(-\frac{3}{25},\ -\frac{4}{25})^{\mathsf T}
4.43189600945 · Agree · 2 × 10⁻¹⁶ · Agree · 0

Independent checks

Numerical verification

Reference values were computed independently with sympy and mpmath (30-digit quadrature, sympy dsolve, sympy laplace_transform) by scratch/ch5/sympy_check.py and stored as a fixture; the lab's TypeScript engine is compared with them below and in the automated tests. The tables are computed on the server when this page is rendered.

1. Differentiation matrix: Φ′ = ΩΦ by direct differentiation

BasisDimensionmax relative |Φ′ − ΩΦ| (Taylor-mode AD, 3 points)
{1, …, x⁸}91.8 × 10⁻¹⁶ Agree · 1.8 × 10⁻¹⁶
{cos 2x, sin 2x}20 Agree · 0
{e^(x/2) cos 3x, e^(x/2) sin 3x}21.3 × 10⁻¹⁶ Agree · 1.3 × 10⁻¹⁶
{e^(−x) cosh 2x, e^(−x) sinh 2x}20 Agree · 0
x³-trig block, ω = 1/381.9 × 10⁻¹⁶ Agree · 1.9 × 10⁻¹⁶
{cos x, sin x} ⊗ {1, x, x²}60 Agree · 0

2. Integrals ∫0aebxf(x) dx\int_0^a e^{bx}f(x)\,dx: MBM vs sympy/mpmath, quadrature and the block exponential

CaseMBM (exact z)sympy / mpmathvs sympyvs quadraturevs block exponentialAD residual of F
poly-x2-2x-b1-a1−1.281718171541−1.281718171541Agree · 1.7 × 10⁻¹⁶Agree · 0Agree · 3.1 × 10⁻¹⁵5.1 × 10⁻¹⁶
poly-x2-2x-b3/2-a2−7.432751680944−7.432751680944Agree · 1.3 × 10⁻¹⁵Agree · 1.3 × 10⁻¹⁵Agree · 2.4 × 10⁻¹⁵1.8 × 10⁻¹⁴
poly-deg5−0.2514796288676−0.2514796288676Agree · 2 × 10⁻¹⁴Agree · 2 × 10⁻¹⁴Agree · 2.4 × 10⁻¹⁴6.7 × 10⁻¹⁴
trig-ex521−7.048682675078−7.048682675078Agree · 1 × 10⁻¹⁵Agree · 2.5 × 10⁻¹⁶Agree · 6 × 10⁻¹⁵3.8 × 10⁻¹⁶
trig-negative-b−0.07697053225685−0.07697053225685Agree · 1.4 × 10⁻¹⁷Agree · 1.4 × 10⁻¹⁷Agree · 3.6 × 10⁻¹⁶2.2 × 10⁻¹⁶
exptrig2.2524672739872.252467273987Agree · 0Agree · 2 × 10⁻¹⁶Agree · 3.2 × 10⁻¹⁵3.3 × 10⁻¹⁶
exphyp3.3307070445493.330707044549Agree · 0Agree · 0Agree · 4.4 × 10⁻¹⁵1.5 × 10⁻¹⁶
xcos-weighted−0.8347757315093−0.8347757315093Agree · 1.1 × 10⁻¹⁶Agree · 1.1 × 10⁻¹⁶Agree · 5.6 × 10⁻¹⁶1.1 × 10⁻¹⁶
xcos-b00.10061200427610.1006120042761Agree · 1.4 × 10⁻¹⁷Agree · 2.8 × 10⁻¹⁷Agree · 8.3 × 10⁻¹⁷5.6 × 10⁻¹⁷
x2cos-b00.074885796334850.07488579633485Agree · 4.2 × 10⁻¹⁷Agree · 5.6 × 10⁻¹⁷Agree · 2 × 10⁻¹⁵2.2 × 10⁻¹⁶
x3sin4.2701977308774.270197730877Agree · 0Agree · 0Agree · 2.1 × 10⁻¹⁶9.1 × 10⁻¹⁶
prod-x-cos2x−0.493818600802−0.493818600802Agree · 0Agree · 5.6 × 10⁻¹⁷Agree · 2.3 × 10⁻¹⁵1.1 × 10⁻¹⁶
prod-exptrig-x20.38291514955450.3829151495545Agree · 0Agree · 5.6 × 10⁻¹⁷Agree · 5.6 × 10⁻¹⁷2.2 × 10⁻¹⁶
prod-trig-trig0.36419540521560.3641954052156Agree · 1.7 × 10⁻¹⁶Agree · 1.1 × 10⁻¹⁶Agree · 5 × 10⁻¹⁵2.9 × 10⁻¹⁶
res-poly-b0 (resonant: limit value)−0.6666666666667−0.6666666666667Agree · 1.1 × 10⁻¹⁶Agree · 0Agree · 1.1 × 10⁻¹⁶n/a (enlarged space)
res-exp (resonant: limit value)7.57.5Agree · 0Agree · 0Agree · 0n/a (enlarged space)
res-exphyp (resonant: limit value)7.1997687541437.199768754143Agree · 3.7 × 10⁻¹⁶Agree · 3.7 × 10⁻¹⁶Agree · 1.1 × 10⁻¹⁴n/a (enlarged space)
res-cos-cos-b0 (resonant: limit value)0.8107993761730.810799376173Agree · 1.1 × 10⁻¹⁶Agree · 0Agree · 2.2 × 10⁻¹⁶n/a (enlarged space)
res-cos-sin-b0 (resonant: limit value)0.41341090521590.4134109052159Agree · 0Agree · 5.6 × 10⁻¹⁷Agree · 1.2 × 10⁻¹⁵n/a (enlarged space)

3. Laplace transforms: resolvent form vs sympy

Casesympy L(s)Lab uᵀ(sI − Ω)⁻¹Φ(0)sympy valueVerdict
L-cos3s/(s**2 + 9)0.15384615384620.1538461538462Agree · 2.8 × 10⁻¹⁷
L-sin22/(s**2 + 4)0.47058823529410.4705882352941Agree · 0
L-exp2/(2*s - 3)0.40.4Agree · 5.6 × 10⁻¹⁷
L-x22/s**30.1280.128Agree · 2.8 × 10⁻¹⁷
L-exptrig-sin8/(4*s**2 - 4*s + 17)0.19512195121950.1951219512195Agree · 2.8 × 10⁻¹⁷
L-xcos(s**2 - 4)/(s**4 + 8*s**2 + 16)0.029585798816570.02958579881657Agree · 6.9 × 10⁻¹⁸
L-exphyp(s - 1)/(s**2 - 2*s - 3)0.60.6Agree · 0
L-mix(2*s - 3)/(s**2 + 1)−2.1−2.1Agree · 0

4. ODEs: MBM (+ companion exponential) vs sympy dsolve and RK4

CaseOrderLab y(x)sympy dsolvevs sympyvs RK4
O-ex114.8710497025274.871049702527Agree · 1.8 × 10⁻¹⁶Agree · 1.7 × 10⁻¹⁴
O-ex211.3270595765171.327059576517Agree · 0Agree · 2 × 10⁻¹⁴
O-ex310.16879999171120.1687999917112Agree · 2.8 × 10⁻¹⁷Agree · 3.9 × 10⁻¹⁵
O-ex611.7634072418791.763407241879Agree · 1.3 × 10⁻¹⁶Agree · 5 × 10⁻¹⁴
O-exercise110.40175470663550.4017547066355Agree · 5.6 × 10⁻¹⁷Agree · 7.2 × 10⁻¹⁵
O-y0145.042123548945.0421235489Agree · 0Agree · 3.8 × 10⁻¹⁵
O-res-exp (resonant)18.9154583639118.915458363911Agree · 2 × 10⁻¹⁶Agree · 1.5 × 10⁻¹⁴
O-res-poly (resonant)12.1252.125Agree · 0Agree · 2.7 × 10⁻¹⁴
O-res-trig10.90929742682570.9092974268257Agree · 0Agree · 1.2 × 10⁻¹³
N-osc20.42431376775710.4243137677571Agree · 5.6 × 10⁻¹⁷Agree · 1.4 × 10⁻¹⁴
N-poly20.60092798759680.6009279875968Agree · 1.8 × 10⁻¹⁵Agree · 7 × 10⁻¹⁴
N-res-sin (resonant)20.870795549960.87079554996Agree · 0Agree · 1.6 × 10⁻¹⁴
N-third30.18075878736970.1807587873697Agree · 1.3 × 10⁻¹⁵Agree · 1.3 × 10⁻¹⁵
N-double-res (resonant)22.390484184372.39048418437Agree · 1.9 × 10⁻¹⁶Agree · 5.8 × 10⁻¹⁵
N-fourth40.34702214925950.3470221492595Agree · 1.3 × 10⁻¹⁵Agree · 3 × 10⁻¹⁵

The automated tests (node --test "lib/math/ch5/*.test.ts") additionally check every exact vector z against sympy rationals, the book's ready matrices and worked examples entry by entry, the corrected diagonal rule against the exact inverse for n up to 10, and that the untransposed Kronecker system gives a wrong value.

When the formulas hold

Assumptions & domain

book §5.2.7, §5.3.2

Hypotheses of the MBM formula

  • Closure: ff lies in a finite-dimensional space VV closed under differentiation, Φ′=ΩΦ\Phi'=\Omega\Phi with a constant Ω\Omega.
  • Independence of the basis makes (bI+ΩT)z=u(bI+\Omega^{\mathsf T})z=u necessary as well as sufficient. For Kronecker states Ψ\Psi may repeat a function (cos·sin and sin·cos); the solved system is still sufficient.
  • Invertibility: det⁡(bI+ΩT)≠0\det(bI+\Omega^{\mathsf T})\neq0, i.e. −b-b is not an eigenvalue of Ω\Omega.
  • Endpoints: the boundary primitive is finite on [0,a][0,a] (always true for the families here).

Remark 13, §5.3.4

Resonant and near-resonant inputs

  • Singular bI+ΩTbI+\Omega^{\mathsf T} is reported with a specific reason (polynomials at b=0b = 0, b+α=0b+\alpha=0 for eαxe^{\alpha x}, (b+α)2=ω2(b+\alpha)^2=\omega^2 for exp–hyp, −b=λ+μ-b=\lambda+\mu for products).
  • The book's remedy is a limit or a decomposition. The lab shows the limit three ways: MBM values at b+hb + h as h→0h → 0; the block exponential uT[∫0aex(Ω+bI)dx]Φ(0)u^{\mathsf T}\big[\int_0^a e^{x(\Omega+bI)}dx\big]\Phi(0) (Van Loan's identity — standard linear algebra, not a book formula); and an exact solve in the enlarged space {1,…,xk}⊗Φ\{1,\dots,x^k\}\otimes\Phi (a lab construction; it produces the familiar x eλxx\,e^{\lambda x} terms).
  • Near resonance the boundary difference F(a)−F(0)F(a) − F(0) cancels; when it loses more than six digits the lab also shows the block-exponential value.

Remark 16

Laplace transform

  • The integral over [0,∞)[0,\infty) is used only for Re⁡s>max⁡Re⁡λ(Ω)\operatorname{Re}s>\max\operatorname{Re}\lambda(\Omega), the book's condition (sufficient; a particular uu may converge on a larger set).
  • Outside that region the resolvent expression is labelled as an analytic continuation, not as the value of the integral.
  • At an eigenvalue of Ω\Omega the transform has a pole and nothing is reported as a value.

§5.2.8, §5.3.7

ODEs

  • First order follows eq. (5.1) exactly: y′−by=f, y(0)=y0y'-by=f,\ y(0)=y_0.
  • M(−b)uM(-b)u gives the algebraic particular solution in VV; the causal solution adds ebx(y0−yp(0))e^{bx}(y_0-y_p(0)), which in general lies outside VV.
  • Orders 2–4 are a lab implementation of the book's remark that higher orders are handled in state-space form: P(ΩT)z=uP(\Omega^{\mathsf T})z=u for the particular solution and exCe^{xC} of the companion matrix for the initial values. Resonance means P(λ)=0P(\lambda)=0 at an eigenvalue of Ω\Omega.

Implementation

Arithmetic and limits

  • Typed decimals are read as exact rationals (0.1 = 1/10). Matrices, zz, M(b)M(b), symbolic z(b)z(b) and Laplace rational functions are exact; boundary values involving ebae^{ba}, cos, sin are then evaluated in double precision from the exact zz. A floating-point path is available and is used automatically if exact numbers grow too long.
  • Caps: polynomial degree ≤ 8, x^k-trig blocks k ≤ 3, joint Kronecker dimension ≤ 36, |b| ≤ 10, 0 ≤ a ≤ 10, |ω| ≤ 20 (sliders ±10), |α| ≤ 5, ODE order ≤ 4; inputs whose exponentials would overflow are refused with a reason.
  • Real parameters only. All identities are ordinary-function identities on bounded intervals; no distributions are involved.

Scope

Not supported

  • Functions outside the listed families (e.g. sinc, ln x); the book expands such functions into a closed basis first.
  • Variable-coefficient ODEs, complex weights, symbolic parameters (ω, α, b are numbers here; symbolic forms in b and s are shown where exact).
  • ω=0\omega=0 for trigonometric or hyperbolic families (the functions are then dependent, so they are not a basis).

Where this comes from

Source

Corrected book

Analytical Methods for Higher-Order Derivatives, Integral Transforms, and Matrix-Based Techniques (corrected edition). Section numbers and printed pages below are generated from the corrected PDF.

  • Ch. 5Matrix Boundary Method: Truncated Laplace Integrals and Differential Equationsp. 135
  • §5.1Linear Spaces of Functions: Concepts and Structure and The meaning of “space”p. 135
  • §5.1.10Closure under differentiationp. 138
  • §5.2Finite-Dimensional Closure and the MBM Representationp. 138
  • §5.2.1Vector representation of functions in a finite-dimensional spacep. 138
  • §5.2.2Matrix representation of differentiationp. 139
  • §5.2.3The structured integral problemp. 140
  • §5.2.5Candidate antiderivative (MBM ansatz)p. 140
  • §5.2.7Matching the derivative with the integrandp. 141
  • §5.2.8Operator interpretation: algebraic particular inverse versus causal inversep. 141
  • §5.2.9Basic laws and recipep. 144
  • §5.2.10Canonical bases and ready matricesp. 144
  • §5.2.11Worked examples for integralsp. 145
  • §5.3Generalization: MBM for productsp. 146
  • §5.3.1Definition (Kronecker-state MBM)p. 146
  • §5.3.2When does it apply? (conditions)p. 147
  • §5.3.3Worked examples (fully detailed)p. 147
  • §5.3.4Remarks and edge casesp. 150
  • §5.3.5Exponential-Matrix Variantp. 150
  • §5.3.6Appendix B: Two proofs of the exponential–matrix integral formulap. 152
  • §5.3.7Linear ODEs via MBMp. 155
  • §5.3.8Ready kernels (reuse from Part I)p. 155

Reference implementation

The interactive cases on this page are ported from the author's open-source lab. Where the repository and the corrected book disagree, the book is followed and the difference is listed below.

mbm-calculator on GitHub (opens in a new tab)

https://github.com/rida313jamal-source/mbm-calculator

Corrections applied (8)

ItemEarlier text (GitHub / old site)Corrected book (used here)
Joint resolvent of the Kronecker-state MBM §5.3.1Repository (“Generalization: MBM for Products”): M⊗(b)=(bI+Ωg⊗I+I⊗Ωf)−1M_\otimes(b)=\big(bI+\Omega_g\otimes I+I\otimes\Omega_f\big)^{-1} — no transposes.M⊗(b)=(bI+ΩgT⊗I+I⊗ΩfT)−1=(bI+Ω⊗T)−1M_\otimes(b)=\big(bI+\Omega_g^{\mathsf T}\otimes I+I\otimes\Omega_f^{\mathsf T}\big)^{-1}=\big(bI+\Omega_\otimes^{\mathsf T}\big)^{-1}, solve (bI+ΩgT⊗I+I⊗ΩfT)z=w(bI+\Omega_g^{\mathsf T}\otimes I+I\otimes\Omega_f^{\mathsf T})z=w. The untransposed form gives wrong values whenever Ω⊗\Omega_\otimes is not symmetric (shown live in the Products mode).
Polynomial diagonal–Laplace rule §5.3.6Repository (dashboard section “Canonical Bases and Ready Matrices”, 5.5, its matrix expander and its diagonal-matrix helper): Mi,i+k=(−1)k(i)k k!tk+1M_{i,i+k}=(-1)^k(i)_k\,\dfrac{k!}{t^{k+1}} — an extra k!k!.Mi,i+k=(−1)k(i)kk!L{xk}=(−1)k(i)k1tk+1M_{i,i+k}=(-1)^k\dfrac{(i)_k}{k!}\mathcal L\{x^k\}=(-1)^k(i)_k\dfrac{1}{t^{k+1}}, equal to (tI+ΩT)−1(tI+\Omega^{\mathsf T})^{-1} entry by entry (book n=4n=4 matrix: 2/t32/t^3, −6/t4-6/t^4, 24/t524/t^5, …). The repository's entries are wrong for every k≥2k\ge2.
Meaning of (bI+ΩT)−1(bI+\Omega^{\mathsf T})^{-1} §5.2.8Repository (4.2) and the previous site's MBM texts: (D+b)−1f=ΦT(bI+ΩT)−1u(D+b)^{-1}f=\Phi^{\mathsf T}(bI+\Omega^{\mathsf T})^{-1}u, i.e. the matrix “is the finite-dimensional representation of the inverse operator (D+b)−1(D+b)^{-1}”, with (D+b)−1(D+b)^{-1} defined causally.(bI+ΩT)−1(bI+\Omega^{\mathsf T})^{-1} is the algebraic map to a particular solution yp=ΦT(bI+ΩT)−1uy_p=\Phi^{\mathsf T}(bI+\Omega^{\mathsf T})^{-1}u in VV; the causal solution is yc=yp−e−bxyp(0)y_c=y_p-e^{-bx}y_p(0) and need not lie in VV (on span⁡{1}\operatorname{span}\{1\}: 1/b1/b versus (1−e−bx)/b(1-e^{-bx})/b). The boundary subtraction supplies the endpoint condition.
Final line of the polynomial example ∫0aebx(x2−2x) dx\int_0^a e^{bx}(x^2-2x)\,dx §5.2.11An earlier manuscript of this example: the final closed form agreed with the integral only at b = 1.eba[a2b−(2b+2b2)a+2b2+2b3]−2b2−2b3e^{ba}\big[\tfrac{a^2}{b}-(\tfrac2b+\tfrac2{b^2})a+\tfrac2{b^2}+\tfrac2{b^3}\big]-\tfrac2{b^2}-\tfrac2{b^3} for every b≠0b\neq0; at a=b=1a=b=1 it equals e−4e-4. Verified symbolically with sympy and numerically in the lab.
Singular (resonant) systems §5.3.4Repository calculators call np.linalg.solve with no check: its own default input (P(x)=xP(x)=x, b=0b=0) raises a LinAlgError; ODE resonance is likewise unhandled.det⁡(bI+ΩT)=0\det(bI+\Omega^{\mathsf T})=0 is detected exactly and explained per basis (Remark 13: (b+α)2=ω2(b+\alpha)^2=\omega^2 for exp–hyp; §5.3.2: product resonances). The limiting value is shown, as the book prescribes (“take limits”, §5.3.4), with three independent routes.
Laplace calculator: region of convergence §5.3.6Repository Laplace calculator accepts any s≥0.1s\ge0.1 and prints uT(sI−Ω)−1Φ(0)u^{\mathsf T}(sI-\Omega)^{-1}\Phi(0) as “the Laplace value” (e.g. L{ex}(0.5)=−2\mathcal L\{e^{x}\}(0.5)=-2).The integral equals uT(sI−Ω)−1Φ(0)u^{\mathsf T}(sI-\Omega)^{-1}\Phi(0) only when e−a(sI−Ω)→0e^{-a(sI-\Omega)}\to0, i.e. Re⁡s>max⁡Re⁡λ(Ω)\operatorname{Re}s>\max\operatorname{Re}\lambda(\Omega) (Remark 16, Example 5.4: Re⁡s>α\operatorname{Re}s>\alpha). The region is shown beside every result; outside it the value is labelled as an analytic continuation.
Polynomial generator in the repository helper §5.2.10Repository helper that builds the polynomial basis from an expression: Ωi−1,i=i\Omega_{i-1,i}=i, which is ΩT\Omega^{\mathsf T} (it would encode Φ′=ΩTΦ\Phi'=\Omega^{\mathsf T}\Phi). The helper is not used by the repository's calculators, which use the correct matrix.For Φ=(1,x,…,xn)T\Phi=(1,x,\dots,x^n)^{\mathsf T}: Ωi,i−1=i\Omega_{i,i-1}=i, so ΩT\Omega^{\mathsf T} is the upper bidiagonal matrix of the book (ΩT=(010002000)\Omega^{\mathsf T}=\begin{pmatrix}0&1&0\\0&0&2\\0&0&0\end{pmatrix} for n=2n=2).
First-order ODE initial value (previous site lab) §5.3.7Previous lab: only y′−by=fy'-by=f with y(0)=0y(0)=0; products, the exponential-matrix variant and higher orders listed as unsupported.Book eq. (5.1) in full: y(x)=ebxy0+ebx[e−bsΦ(s)TM(−b)u]0xy(x)=e^{bx}y_0+e^{bx}\big[e^{-bs}\Phi(s)^{\mathsf T}M(-b)u\big]_0^x, with the algebraic/causal split of §5.2.8; products, Prop. 5.3.1 and higher orders are now implemented.

Parity with the repository

Every section of mbm_dashboard_v3.py is covered: the theory sections (linear spaces, MBM representation, operator interpretation, canonical bases, worked examples, products, exponential-matrix variant, Laplace connection, linear ODEs) are in Theory and Worked examples; its integral calculator (five families), Laplace calculator (nine families) and the polynomial diagonal matrix expander are interactive modes above. The sidebar's “ODE Calculator” had no implementation in the repository; it is implemented here for orders 1–4. The product, exponential-matrix and resonance tools are additions grounded in the book.