omnibias.torch.activations.trigonometric
PyTorch activation derivatives, trainable operator layers, network jets, and direct differential-operator contractions.
import omnibias.torch.activations.trigonometricModule contract & mathematical conventions
Trigonometric & hyperbolic activations for physics-class wavefunctions.
These activations target physics-class wavefunctions and periodic / lattice-Bloch neural-VMC. Every spec exposes a closed-form n-th derivative; the supported orders depend on the activation:
================== ========================================= ===================
Activation n-th derivative formula Max fastpath order
================== ========================================= ===================
sin(z) sin(z + n * pi/2) every n
cos(z) cos(z + n * pi/2) every n
sinh(z) alternating sinh / cosh every n
cosh(z) alternating cosh / sinh every n
tan(z) Riccati P(t) = 1 + t^2 n in {0, 1, 2, 3}
cot(z) Riccati P(c) = -(1 + c^2) n in {0, 1, 2, 3}
sech(z) sech * (1 - 2 sech^2) etc. n in {0, 1, 2, 3}
coth(z) Riccati P(c) = 1 - c^2 (tanh-like) n in {0, 1, 2, 3}
================== ========================================= ===================
All four hyperbolic activations are closed-form for arbitrarily many orders;
the support cap on tan / cot / sech is purely a development cost
choice — the recursions are well known and can be extended on demand.
Physical motivation
sin/cos— plane-wave embeddings for periodic systems (Bloch wavefunctions on a lattice; k-point sampling for crystalline Hamiltonians).sinh/cosh— anti-Bragg / evanescent states; logarithmic derivatives of Slater determinants in 1D models with linear backbone symmetry.sech— soliton wavefunctions (sine-Gordon, KdV, NLS); Pöschl-Teller potential bound states; the canonicalsech^2reflectionless potential.tan/cot— phase-only activations for unitary RNN-style amplitude/phase factorisations, and as raw building blocks for the envelope-modulator branch of period-aware ansatze.coth— Langevin-function-like saturation; thermal-state amplitude in finite-T NQS. Riccati-class (same polynomial shape as tanh).
Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.
COS
omnibias.torch.activations.trigonometric.COSSource ↗COS = register_activation(ActivationSpec(name='cos', forward=_cos_forward, derivative=_cos_derivative, fastpath=_cos_fastpath, integral=_cos_integral, riccati_polynomial=None, noise_model='none', operator_role='Plane-wave / Bloch embedding (real part); cos(z + n*pi/2) gives every order in closed form.'))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
COS = register_activation(
ActivationSpec(
name="cos",
forward=_cos_forward,
derivative=_cos_derivative,
fastpath=_cos_fastpath,
integral=_cos_integral,
riccati_polynomial=None,
noise_model="none",
operator_role=(
"Plane-wave / Bloch embedding (real part); cos(z + n*pi/2) "
"gives every order in closed form."
),
)
)COSH
omnibias.torch.activations.trigonometric.COSHSource ↗COSH = register_activation(ActivationSpec(name='cosh', forward=_cosh_forward, derivative=_cosh_derivative, fastpath=_cosh_fastpath, integral=_cosh_integral, riccati_polynomial=None, noise_model='none', operator_role='Hyperbolic even primitive; eigenfunction of d^2/dz^2 with eigenvalue +1; alternates with sinh under differentiation.'))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
COSH = register_activation(
ActivationSpec(
name="cosh",
forward=_cosh_forward,
derivative=_cosh_derivative,
fastpath=_cosh_fastpath,
integral=_cosh_integral,
riccati_polynomial=None,
noise_model="none",
operator_role=(
"Hyperbolic even primitive; eigenfunction of d^2/dz^2 with "
"eigenvalue +1; alternates with sinh under differentiation."
),
)
)COT
omnibias.torch.activations.trigonometric.COTSource ↗COT = register_activation(ActivationSpec(name='cot', forward=_cot_forward, derivative=_cot_derivative, fastpath=_cot_fastpath, integral=_cot_integral, riccati_polynomial=(-1.0, 0.0, -1.0), noise_model='none', operator_role="Riccati-class periodic activation; cot'(z) = -(1 + cot^2(z)); complementary to tan in phase-only ansatze.", aliases=('ctg', 'ctan')))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
COT = register_activation(
ActivationSpec(
name="cot",
forward=_cot_forward,
derivative=_cot_derivative,
fastpath=_cot_fastpath,
integral=_cot_integral,
riccati_polynomial=(-1.0, 0.0, -1.0), # P(c) = -(1 + c^2)
noise_model="none",
operator_role=(
"Riccati-class periodic activation; cot'(z) = -(1 + cot^2(z)); "
"complementary to tan in phase-only ansatze."
),
aliases=("ctg", "ctan"),
)
)COTH
omnibias.torch.activations.trigonometric.COTHSource ↗COTH = register_activation(ActivationSpec(name='coth', forward=_coth_forward, derivative=_coth_derivative, fastpath=_coth_fastpath, integral=_coth_integral, riccati_polynomial=(1.0, 0.0, -1.0), noise_model='none', operator_role="Hyperbolic Riccati: coth'(z) = 1 - coth^2(z); Langevin-like saturation, finite-T NQS amplitude."))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
COTH = register_activation(
ActivationSpec(
name="coth",
forward=_coth_forward,
derivative=_coth_derivative,
fastpath=_coth_fastpath,
integral=_coth_integral,
riccati_polynomial=(1.0, 0.0, -1.0), # P(c) = 1 - c^2 (same shape as tanh)
noise_model="none",
operator_role=(
"Hyperbolic Riccati: coth'(z) = 1 - coth^2(z); Langevin-like "
"saturation, finite-T NQS amplitude."
),
)
)SECH
omnibias.torch.activations.trigonometric.SECHSource ↗SECH = register_activation(ActivationSpec(name='sech', forward=_sech_forward, derivative=_sech_derivative, fastpath=_sech_fastpath, integral=_sech_integral, riccati_polynomial=None, noise_model='none', operator_role='Soliton bound-state amplitude: sech(z) is the Poschl-Teller ground state and the sine-Gordon / KdV / NLS soliton profile.'))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
SECH = register_activation(
ActivationSpec(
name="sech",
forward=_sech_forward,
derivative=_sech_derivative,
fastpath=_sech_fastpath,
integral=_sech_integral,
riccati_polynomial=None,
noise_model="none",
operator_role=(
"Soliton bound-state amplitude: sech(z) is the Poschl-Teller "
"ground state and the sine-Gordon / KdV / NLS soliton profile."
),
)
)SIN
omnibias.torch.activations.trigonometric.SINSource ↗SIN = register_activation(ActivationSpec(name='sin', forward=_sin_forward, derivative=_sin_derivative, fastpath=_sin_fastpath, integral=_sin_integral, riccati_polynomial=None, noise_model='none', operator_role='Plane-wave / Bloch embedding; eigenfunction of d^2/dz^2 with eigenvalue -1; sin(z + n*pi/2) gives every order in closed form.'))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
SIN = register_activation(
ActivationSpec(
name="sin",
forward=_sin_forward,
derivative=_sin_derivative,
fastpath=_sin_fastpath,
integral=_sin_integral,
riccati_polynomial=None,
noise_model="none",
operator_role=(
"Plane-wave / Bloch embedding; eigenfunction of d^2/dz^2 with "
"eigenvalue -1; sin(z + n*pi/2) gives every order in closed form."
),
)
)SINH
omnibias.torch.activations.trigonometric.SINHSource ↗SINH = register_activation(ActivationSpec(name='sinh', forward=_sinh_forward, derivative=_sinh_derivative, fastpath=_sinh_fastpath, integral=_sinh_integral, riccati_polynomial=None, noise_model='none', operator_role='Hyperbolic odd primitive; eigenfunction of d^2/dz^2 with eigenvalue +1; alternates with cosh under differentiation.'))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
SINH = register_activation(
ActivationSpec(
name="sinh",
forward=_sinh_forward,
derivative=_sinh_derivative,
fastpath=_sinh_fastpath,
integral=_sinh_integral,
riccati_polynomial=None,
noise_model="none",
operator_role=(
"Hyperbolic odd primitive; eigenfunction of d^2/dz^2 with "
"eigenvalue +1; alternates with cosh under differentiation."
),
)
)TAN
omnibias.torch.activations.trigonometric.TANSource ↗TAN = register_activation(ActivationSpec(name='tan', forward=_tan_forward, derivative=_tan_derivative, fastpath=_tan_fastpath, integral=_tan_integral, riccati_polynomial=(1.0, 0.0, 1.0), noise_model='none', operator_role="Riccati-class periodic activation; tan'(z) = 1 + tan^2(z); phase factor in unitary-RNN amplitude/phase factorisations."))This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.
Read the implementation
TAN = register_activation(
ActivationSpec(
name="tan",
forward=_tan_forward,
derivative=_tan_derivative,
fastpath=_tan_fastpath,
integral=_tan_integral,
riccati_polynomial=(1.0, 0.0, 1.0), # P(t) = 1 + t^2
noise_model="none",
operator_role=(
"Riccati-class periodic activation; tan'(z) = 1 + tan^2(z); "
"phase factor in unitary-RNN amplitude/phase factorisations."
),
)
)