Shunyaya Symbolic Mathematics — Vector/matrix-valued functions (2.47)

Abstract
We extend SSM to vectors and matrices with entries (m, a). Linear algebra on the magnitude channel follows classical rules; alignment propagates through products via M2 (rapidity-additive) and through sums via a rapidity-weighted mean. We formalize trace, determinant, matrix powers/exp/log, matrix–vector products, and give default guards for domains (e.g., log(A) on SPD). Under collapse phi(m,a)=m, all statements reduce exactly to classical linear algebra.


Objects and base rules

Let a symbolic matrix be A = [ (m_ij, a_ij) ]. Write U = atanh(a) elementwise with a clamped to (-1+eps, 1-eps), eps = 1e-6. Constants carry alignment +1 and do not change alignment under M2.

Matrix addition (entrywise).

C = A + B
phi(C)_ij = m_ij(A) + m_ij(B)
u_ij(C)   = weighted_mean_u( [u_ij(A), u_ij(B)], weights = [ |m_ij(A)|, |m_ij(B)| ] )
a_ij(C)   = tanh( u_ij(C) )

Scalar multiplication.

(c,+1) * (m,a)  ->  ( c*m , a )         # constants leave alignment unchanged

Matrix product (per entry via sum of products).
For C = A B, each entry c_ij = sum_k a_ik * b_kj:

Term k magnitude:   t_k = m_ik(A) * m_kj(B)
Term k alignment:   u_k = u_ik(A) + u_kj(B)     # M2: atanh(a_prod) = u1 + u2
Aggregate entry u:  u_ij(C) = weighted_mean_u( {u_k}, weights = {|t_k|} )
a_ij(C) = tanh( u_ij(C) )
phi(C)_ij = sum_k t_k

Weighted mean in rapidity.

weighted_mean_u( {u_s}, {w_s} ) = ( sum_s w_s * u_s ) / ( sum_s w_s )   if sum w_s > 0
fallback: mean(u_s)


Scalar-valued functions of matrices

Trace (linear).

tr*(A) = ( tr( phi(A) ) , a_tr )
u_tr = weighted_mean_u( { u_ii(A) }, weights = { |m_ii(A)| } )
a_tr = tanh(u_tr)

Frobenius norm.

||A||_F^2 = sum_{i,j} m_ij^2
||A||_F^* = ( ||A||_F , a_F )
u_F = weighted_mean_u( { u_ij(A) }, weights = { |m_ij|^2 } )
a_F = tanh(u_F)

Determinant (polynomial of entries).
Use cofactor sensitivities (gradient of det):

phi( det*(A) ) = det( phi(A) )
Let G = | adj( phi(A) )^T |   # |∂ det / ∂ A_ij| = |C_ji|
u_det = weighted_mean_u( { u_ij(A) }, weights = { G_ij } )
a_det = tanh(u_det)
det*(A) = ( det(phi(A)) , a_det )

Guard: if phi(A) is singular/near-singular, report a warning and the chosen weights/regularization (e.g., Tikhonov).


Matrix powers, exp, and log

Integer powers.
A^k via repeated products using the product rule above.

Fractional powers and principal log/exp (spectral calculus).
For symmetric positive definite (SPD) A:

phi(A) = Q diag(λ_1,…,λ_n) Q^T,  λ_i > 0
f*(A) = ( Q diag( f(λ_i) ) Q^T , A_align' )

Alignment per entry is aggregated from eigen-channels:

Choose eigen-rapidity u_λi (see below), then
u_ij' = weighted_mean_u( { u_λi }, weights = { | Q_{i i} * f(λ_i) * Q_{j i} | } )
a_ij' = tanh(u_ij')

Eigenvalue alignment (SPD default).
When A is SPD and diagonalizable orthogonally:

  • If A is diagonal, set u_λi = u_ii(A).
  • In general, approximate u_λi by sensitivity weights of Rayleigh quotients: λ_i = v_i^T phi(A) v_i u_λi = weighted_mean_u( { u_pq(A) }, weights = { | v_i(p) v_i(q) | } )

Declare this policy in the manifest if used.

Domains/guards.

exp(A):    all square matrices (magnitude channel)
log(A):    SPD (principal real log) by default
A^α:       SPD for real α (principal), or real diagonalizable with positive spectrum
log/frac_power.guard = "error" outside domain | "extend_complex" (if enabled)


Matrix–vector maps

For y = A x with x = ( (m_j, a_j) ):

phi(y)_i = sum_j m_ij(A) * m_j(x)
u_ij(term) = u_ij(A) + u_j(x)               # M2 for the product
u_i(y) = weighted_mean_u( { u_ij(term) }, weights = { | m_ij(A) m_j(x) | } )
a_i(y) = tanh( u_i(y) )

This matches the matrix product rule with one factor being a vector.


Worked examples

A) Trace and determinant (2×2).

A = [ (1, 0.8)   (2, 0.4)
      (-1, 0.6)  (3, 1.0) ]

tr:  phi = 1 + 3 = 4
u_tr = weighted_mean_u( {atanh(0.8), atanh(1.0)}, weights = {1, 3} )
     ≈ (0.5*(1.0986) + 1.5*(+∞?)) / 2.0 → use clamp to 1−eps ⇒ u≈(1*0.5 + large)/2
Practical: clamp a=+1 to 1−eps ⇒ u_ii ≈ 7.25 (for eps=1e-6)
u_tr ≈ (1*1.0986 + 3*7.2543) / 4 ≈ 5.715
a_tr = tanh(5.715) ≈ 0.999
tr*(A) ≈ ( 4 , 0.999 )

(Interpretation: diagonal (3, +1) dominates trace magnitude and alignment.)

det magnitude: 1*3 − 2*(−1) = 5
Cofactor weights (|adj^T|):  G = [ |3|  |1| ; |2|  |1| ] = [3 1; 2 1]
u_det = weighted_mean_u( {0.8, 0.4, 0.6, 1.0} via atanh, weights {3,1,2,1} )
a_det ≈ tanh( (3*1.0986 + 1*0.4236 + 2*0.6931 + 1*7.2543)/7 ) ≈ 0.989
det*(A) ≈ ( 5 , 0.989 )

B) Matrix–vector product.

A = [ (2, 0.5)  (−1, 0.1) ]
x = [ (3, 0.8) ; (4, 0.2) ]
phi(y) = [ 2*3 + (−1)*4 ] = [ 2 ]
Term rapidities: u1 = atanh(0.5)+atanh(0.8),  u2 = atanh(0.1)+atanh(0.2)
Weights: |2*3|=6, |(−1)*4|=4
u_y = (6*u1 + 4*u2)/10  ⇒  a_y = tanh(u_y) ≈ moderately Pearo (exact numbers per clamp)
y* ≈ ( 2 , a_y )

C) SPD spectral log (diagonal).

A = diag( (4, 0.6), (9, 0.3) )     # SPD
log*(A):  phi = diag( log 4 , log 9 )
u_λ1 = atanh(0.6),  u_λ2 = atanh(0.3)
Entry (1,1): a_11' = tanh( u_λ1 ) = 0.6
Entry (2,2): a_22' = tanh( u_λ2 ) = 0.3
Off-diagonals remain zero with canonical alignment +1.


Implementation notes (manifest)

mult_mode            = "M2"                   # product alignment via u-sum
sum_alignment        = "rapidity_weighted"    # weights = absolute contributions
eps                  = 1e-6                   # clamp for atanh
zero_policy          = "canonical_zero"       # (0,+1) when magnitude is 0

trace.weights        = |m_ii|
frobenius.weights    = |m_ij|^2
det.weights          = |adj( phi(A) )^T|      # cofactor sensitivities
mvprod.weights       = |m_ik(A) * m_k(x)|

spectral.domain      = { log: "SPD",  A^α: "SPD or pos. spectrum" }
eigen_alignment      = "rayleigh_sensitivity" # or "diagonal_only" when A diagonal
spectral.recombine   = "u-mean with |Q f(Λ) Q^T| weights"
near_singularity     = "warn_and_report_condition"  # for det/log


Takeaway

Matrix calculus in SSM computes magnitudes exactly as in classical linear algebra while propagating alignment through products via M2 and through sums via rapidity-weighted means. Scalar functionals (trace, norm, det) get principled alignment tags from sensitivity weights; spectral functions (exp/log/powers) follow classical domains with clear alignment aggregation. Collapse (a = +1) restores standard results.


Navigation
Previous → Inequalities through functions (2.46)
Next → Convolution & correlation (scalar kernels) (2.48)


Disclaimer
Observation only. Results reproduce mathematically; domain claims require independent peer review. Defaults: mult_mode = M2, clamp_eps = 1e-6, |a| < 1. Collapse uses phi(m,a) = m.