omnibias.core.transforms_pde
Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.
import omnibias.core.transforms_pdeModule contract & mathematical conventions
Named linearizing PDE transforms (theory 02-13).
Cole-Hopf / Miura / Bäcklund / Darboux only. Exactness is to jet truncation
order N. Integrability *search* (spec 03-11) is not claimed. A multi-kink
sum is not the n-soliton formula unless built by Bäcklund permutability.
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.
Imports & aliases
These names share a definition with another public module. Follow a name for its full contract, parameters, and examples.
| Import from this module | Canonical reference |
|---|---|
TravellingWaveAnsatz | omnibias.core.TravellingWaveAnsatz |
LinearizingTransform
omnibias.core.LinearizingTransformSource ↗class LinearizingTransformDataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.
The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
kinddataclass field | TransformKindRequired | See the operation contract and implementation below. |
sourcedataclass field | PDESpecRequired | See the operation contract and implementation below. |
targetdataclass field | PDESpecRequired | See the operation contract and implementation below. |
parametersdataclass field | Mapping[str, float]Required | See the operation contract and implementation below. |
Fields & methods
kindfield
kind: TransformKindDeclared TransformKind field on LinearizingTransform. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗sourcefield
source: PDESpecDeclared PDESpec field on LinearizingTransform. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗targetfield
target: PDESpecDeclared PDESpec field on LinearizingTransform. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗parametersfield
parameters: Mapping[str, float]Declared Mapping[str, float] field on LinearizingTransform. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗Read the implementation
class LinearizingTransform:
kind: TransformKind
source: PDESpec
target: PDESpec
parameters: Mapping[str, float]Other public import paths
omnibias.core.LinearizingTransformomnibias.core.transforms_pde.LinearizingTransform
TransformKind
omnibias.core.transforms_pde.TransformKindSource ↗class TransformKind(str, Enum)The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Regression example · cole hopf worked example
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_worked_example() -> None:
t = named_cole_hopf()
assert t.kind is TransformKind.COLE_HOPF
assert verify_transform(t, order=8)
assert cole_hopf_from_heat_phi(0.0, 0.0) == -2.0python -m pytest packages/omnibias-core/tests/test_transforms_pde.py -k test_cole_hopf_worked_example -qRead the implementation
class TransformKind(str, Enum):
COLE_HOPF = "cole_hopf"
MIURA = "miura"
BACKLUND = "backlund"
DARBOUX = "darboux"cole_hopf_from_heat_phi
omnibias.core.transforms_pde.cole_hopf_from_heat_phiSource ↗cole_hopf_from_heat_phi(x: float, t: float, *, nu: float=1.0) -> floatWorked example: phi = exp(x+t), u = -2 nu phi_x / phi.
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
tpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
nukeyword-only | floatDefault: 1.0 | See the operation contract and implementation below. |
floatExecuted regression · cole hopf worked example
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_worked_example() -> None:
t = named_cole_hopf()
assert t.kind is TransformKind.COLE_HOPF
assert verify_transform(t, order=8)
assert cole_hopf_from_heat_phi(0.0, 0.0) == -2.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_worked_example" -qRead the implementation
def cole_hopf_from_heat_phi(x: float, t: float, *, nu: float = 1.0) -> float:
"""Worked example: ``phi = exp(x+t)``, ``u = -2 nu phi_x / phi``."""
import math
phi = math.exp(x + t)
phi_x = phi
return cole_hopf_u(phi, phi_x, nu=nu)cole_hopf_jet
omnibias.core.cole_hopf_jetSource ↗cole_hopf_jet(phi: Sequence[float], phi_x: Sequence[float], *, nu: float=1.0) -> list[float]Factorial jet of u = -2 nu (log phi)_x = -2 nu phi_x / phi.
Exact (to jet truncation) Cole--Hopf pushforward: heat jets for phi
and phi_x become a Burgers jet for u by Cauchy product only
(no CAS). The check applies to the supplied finite jet.
Parameters
| Name | Type & default | Contract |
|---|---|---|
phipositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
phi_xpositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
nukeyword-only | floatDefault: 1.0 | See the operation contract and implementation below. |
list[float]Explicit validation & failure cases
- When
len(phi) != len(phi_x), raisesValueError('phi and phi_x jets must have the same length').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · cole hopf jet burgers exact
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_jet_burgers_exact() -> None:
out = verify_cole_hopf_burgers_jet(nu=0.07, k=-1.25, order=10)
assert out["passed"] is True
# constant field: higher jet coeffs vanish
phi = [1.0, 0.0, 0.0]
phi_x = [0.5, 0.0, 0.0]
u = cole_hopf_jet(phi, phi_x, nu=0.1)
assert abs(u[0] - (-0.1)) < 1e-15
# G5: a wrong viscosity is not vacuous
other = cole_hopf_jet(phi, phi_x, nu=0.2)
assert abs(other[0] - u[0]) > 1e-12python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_jet_burgers_exact" -qRead the implementation
def cole_hopf_jet(
phi: Sequence[float],
phi_x: Sequence[float],
*,
nu: float = 1.0,
) -> list[float]:
r"""Factorial jet of ``u = -2 nu (log phi)_x = -2 nu phi_x / phi``.
Exact (to jet truncation) Cole--Hopf pushforward: heat jets for ``phi``
and ``phi_x`` become a Burgers jet for ``u`` by Cauchy product only
(no CAS). The check applies to the supplied finite jet.
"""
if len(phi) != len(phi_x):
raise ValueError("phi and phi_x jets must have the same length")
inv = factorial_jet_reciprocal(phi)
ratio = factorial_jet_multiply(phi_x, inv)
return [-2.0 * float(nu) * c for c in ratio]Other public import paths
omnibias.core.cole_hopf_jetomnibias.core.transforms_pde.cole_hopf_jet
cole_hopf_u
omnibias.core.cole_hopf_uSource ↗cole_hopf_u(phi: float, phi_x: float, *, nu: float=1.0) -> floatu = -2 nu phi_x / phi.
Parameters
| Name | Type & default | Contract |
|---|---|---|
phipositional-or-keyword | floatRequired | See the operation contract and implementation below. |
phi_xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
nukeyword-only | floatDefault: 1.0 | See the operation contract and implementation below. |
floatExplicit validation & failure cases
- When
phi == 0.0, raisesZeroDivisionError('Cole-Hopf requires phi != 0').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · cole hopf worked example
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_worked_example() -> None:
t = named_cole_hopf()
assert t.kind is TransformKind.COLE_HOPF
assert verify_transform(t, order=8)
assert cole_hopf_from_heat_phi(0.0, 0.0) == -2.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_worked_example" -qRead the implementation
def cole_hopf_u(phi: float, phi_x: float, *, nu: float = 1.0) -> float:
"""``u = -2 nu phi_x / phi``."""
if phi == 0.0:
raise ZeroDivisionError("Cole-Hopf requires phi != 0")
return -2.0 * nu * phi_x / phiOther public import paths
omnibias.core.cole_hopf_uomnibias.core.transforms_pde.cole_hopf_u
darboux_dress
omnibias.core.transforms_pde.darboux_dressSource ↗darboux_dress(psi: float, psi_x: float, u: float) -> floatOne Darboux step: u' = u - 2 (log psi)_{xx} via psi_x / psi jet.
Parameters
| Name | Type & default | Contract |
|---|---|---|
psipositional-or-keyword | floatRequired | See the operation contract and implementation below. |
psi_xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
upositional-or-keyword | floatRequired | See the operation contract and implementation below. |
floatExplicit validation & failure cases
- When
psi == 0.0, raisesZeroDivisionError('Darboux requires psi != 0').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · miura and darboux finite
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_miura_and_darboux_finite() -> None:
assert miura_v(0.5, -0.2) == -0.2 + 0.25
assert darboux_dress(2.0, 1.0, 0.3) == 0.3 - 1.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_miura_and_darboux_finite" -qRead the implementation
def darboux_dress(psi: float, psi_x: float, u: float) -> float:
"""One Darboux step: ``u' = u - 2 (log psi)_{xx}`` via ``psi_x / psi`` jet."""
if psi == 0.0:
raise ZeroDivisionError("Darboux requires psi != 0")
# (log psi)_x = psi_x/psi; caller supplies a second derivative through jets.
return u - 2.0 * (psi_x / psi)factorial_jet_multiply
omnibias.core.factorial_jet_multiplySource ↗factorial_jet_multiply(a: Sequence[float], b: Sequence[float]) -> list[float]Cauchy product for factorial jets a_k = f^{(k)}/k!.
Matches the convention of omnibias.torch.jet_mv.jet_multiply in 1-D
(ordinary Cauchy product of the scaled Taylor coefficients).
Parameters
| Name | Type & default | Contract |
|---|---|---|
apositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
bpositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[float]Executed regression · factorial jet reciprocal roundtrip
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_factorial_jet_reciprocal_roundtrip() -> None:
a = [2.0, -0.5, 0.25, -0.125]
b = factorial_jet_reciprocal(a)
prod = factorial_jet_multiply(a, b)
assert abs(prod[0] - 1.0) < 1e-14
assert all(abs(c) < 1e-12 for c in prod[1:])python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_factorial_jet_reciprocal_roundtrip" -qRead the implementation
def factorial_jet_multiply(
a: Sequence[float], b: Sequence[float]
) -> list[float]:
r"""Cauchy product for factorial jets ``a_k = f^{(k)}/k!``.
Matches the convention of :func:`omnibias.torch.jet_mv.jet_multiply` in 1-D
(ordinary Cauchy product of the scaled Taylor coefficients).
"""
n = min(len(a), len(b))
out = [0.0] * n
for k in range(n):
s = 0.0
for j in range(k + 1):
s += float(a[j]) * float(b[k - j])
out[k] = s
return outOther public import paths
omnibias.core.factorial_jet_multiplyomnibias.core.transforms_pde.factorial_jet_multiply
factorial_jet_reciprocal
omnibias.core.factorial_jet_reciprocalSource ↗factorial_jet_reciprocal(a: Sequence[float]) -> list[float]Factorial jet of 1/f from the factorial jet of f (a_0 != 0).
Parameters
| Name | Type & default | Contract |
|---|---|---|
apositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[float]Explicit validation & failure cases
- When
not a, raisesValueError('empty jet'). - When
a0 == 0.0, raisesZeroDivisionError('factorial_jet_reciprocal requires a[0] != 0').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · factorial jet reciprocal roundtrip
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_factorial_jet_reciprocal_roundtrip() -> None:
a = [2.0, -0.5, 0.25, -0.125]
b = factorial_jet_reciprocal(a)
prod = factorial_jet_multiply(a, b)
assert abs(prod[0] - 1.0) < 1e-14
assert all(abs(c) < 1e-12 for c in prod[1:])python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_factorial_jet_reciprocal_roundtrip" -qRead the implementation
def factorial_jet_reciprocal(a: Sequence[float]) -> list[float]:
r"""Factorial jet of ``1/f`` from the factorial jet of ``f`` (``a_0 != 0``)."""
if not a:
raise ValueError("empty jet")
a0 = float(a[0])
if a0 == 0.0:
raise ZeroDivisionError("factorial_jet_reciprocal requires a[0] != 0")
n = len(a)
b = [0.0] * n
b[0] = 1.0 / a0
for k in range(1, n):
s = 0.0
for j in range(1, k + 1):
s += float(a[j]) * b[k - j]
b[k] = -s / a0
return bOther public import paths
omnibias.core.factorial_jet_reciprocalomnibias.core.transforms_pde.factorial_jet_reciprocal
heat_plane_wave_jets
omnibias.core.transforms_pde.heat_plane_wave_jetsSource ↗heat_plane_wave_jets(*, k: float, nu: float, order: int) -> tuple[list[float], list[float]]Time-factorial jets of phi = exp(k x + nu k^2 t) and phi_x at t=0.
Heat identity phi_t = nu phi_xx holds with omega = nu k^2. At a fixed
x the time jet is a_m = (omega^m / m!) phi(x,0); here we report the
jet at x = 0 where phi = 1, phi_x = k.
Parameters
| Name | Type & default | Contract |
|---|---|---|
kkeyword-only | floatRequired | See the operation contract and implementation below. |
nukeyword-only | floatRequired | See the operation contract and implementation below. |
orderkeyword-only | intRequired | See the operation contract and implementation below. |
tuple[list[float], list[float]]Explicit validation & failure cases
- When
order < 0, raisesValueError('order must be >= 0').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · cole hopf jet burgers exact
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_jet_burgers_exact() -> None:
out = verify_cole_hopf_burgers_jet(nu=0.07, k=-1.25, order=10)
assert out["passed"] is True
# constant field: higher jet coeffs vanish
phi = [1.0, 0.0, 0.0]
phi_x = [0.5, 0.0, 0.0]
u = cole_hopf_jet(phi, phi_x, nu=0.1)
assert abs(u[0] - (-0.1)) < 1e-15
# G5: a wrong viscosity is not vacuous
other = cole_hopf_jet(phi, phi_x, nu=0.2)
assert abs(other[0] - u[0]) > 1e-12python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_jet_burgers_exact" -qRead the implementation
def heat_plane_wave_jets(
*,
k: float,
nu: float,
order: int,
) -> tuple[list[float], list[float]]:
r"""Time-factorial jets of ``phi = exp(k x + nu k^2 t)`` and ``phi_x`` at ``t=0``.
Heat identity ``phi_t = nu phi_xx`` holds with ``omega = nu k^2``. At a fixed
``x`` the time jet is ``a_m = (omega^m / m!) phi(x,0)``; here we report the
jet at ``x = 0`` where ``phi = 1``, ``phi_x = k``.
"""
if order < 0:
raise ValueError("order must be >= 0")
import math
omega = float(nu) * float(k) * float(k)
phi = [0.0] * (order + 1)
phi_x = [0.0] * (order + 1)
for m in range(order + 1):
coeff = (omega**m) / float(math.factorial(m))
phi[m] = coeff # phi(0,0)=1
phi_x[m] = float(k) * coeff
return phi, phi_xmiura_v
omnibias.core.transforms_pde.miura_vSource ↗miura_v(u: float, u_x: float) -> floatv = u_x + u^2 (mKdV -> KdV).
Parameters
| Name | Type & default | Contract |
|---|---|---|
upositional-or-keyword | floatRequired | See the operation contract and implementation below. |
u_xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
floatExecuted regression · miura and darboux finite
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_miura_and_darboux_finite() -> None:
assert miura_v(0.5, -0.2) == -0.2 + 0.25
assert darboux_dress(2.0, 1.0, 0.3) == 0.3 - 1.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_miura_and_darboux_finite" -qRead the implementation
def miura_v(u: float, u_x: float) -> float:
"""``v = u_x + u^2`` (mKdV -> KdV)."""
return u_x + u * unamed_cole_hopf
omnibias.core.transforms_pde.named_cole_hopfSource ↗named_cole_hopf(*, nu: float=1.0) -> LinearizingTransformThe module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
nukeyword-only | floatDefault: 1.0 | See the operation contract and implementation below. |
LinearizingTransformExecuted regression · cole hopf worked example
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_worked_example() -> None:
t = named_cole_hopf()
assert t.kind is TransformKind.COLE_HOPF
assert verify_transform(t, order=8)
assert cole_hopf_from_heat_phi(0.0, 0.0) == -2.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_worked_example" -qRead the implementation
def named_cole_hopf(*, nu: float = 1.0) -> LinearizingTransform:
heat = PDESpec(
"heat",
(PDETerm(TermKind.U_T, Fraction(1)), PDETerm(TermKind.U_XX, Fraction(-1))),
)
burgers = PDESpec(
"burgers",
(
PDETerm(TermKind.U_T, Fraction(1)),
PDETerm(TermKind.UU_X, Fraction(1)),
PDETerm(TermKind.U_XX, Fraction(-1)),
),
)
return LinearizingTransform(TransformKind.COLE_HOPF, heat, burgers, {"nu": nu})permutability
omnibias.core.transforms_pde.permutabilitySource ↗permutability(u0: float, u1: float, u2: float, *, a1: float, a2: float) -> floatNonlinear superposition for the Bäcklund / sine-Gordon case.
Parameters
| Name | Type & default | Contract |
|---|---|---|
u0positional-or-keyword | floatRequired | See the operation contract and implementation below. |
u1positional-or-keyword | floatRequired | See the operation contract and implementation below. |
u2positional-or-keyword | floatRequired | See the operation contract and implementation below. |
a1keyword-only | floatRequired | See the operation contract and implementation below. |
a2keyword-only | floatRequired | See the operation contract and implementation below. |
floatExplicit validation & failure cases
- When
a1 == a2, raisesValueError('Bäcklund permutability needs a1 != a2').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Read the implementation
def permutability(u0: float, u1: float, u2: float, *, a1: float, a2: float) -> float:
"""Nonlinear superposition for the Bäcklund / sine-Gordon case."""
# u3 = u0 + 4 arctan( ((a1+a2)/(a1-a2)) tan((u1-u2)/4) ) -- algebraic
import math
if a1 == a2:
raise ValueError("Bäcklund permutability needs a1 != a2")
return u0 + 4.0 * math.atan(((a1 + a2) / (a1 - a2)) * math.tan((u1 - u2) / 4.0))verify_cole_hopf_burgers_jet
omnibias.core.verify_cole_hopf_burgers_jetSource ↗verify_cole_hopf_burgers_jet(*, nu: float=0.1, k: float=-0.5, order: int=8) -> dict[str, float | bool]Exact Cole--Hopf: plane-wave heat -> constant Burgers u = -2 nu k.
The Burgers residual of a constant field is identically zero, so every
time-jet coefficient of u beyond order 0 must vanish.
Parameters
| Name | Type & default | Contract |
|---|---|---|
nukeyword-only | floatDefault: 0.1 | See the operation contract and implementation below. |
kkeyword-only | floatDefault: -0.5 | See the operation contract and implementation below. |
orderkeyword-only | intDefault: 8 | See the operation contract and implementation below. |
dict[str, float | bool]Executed regression · cole hopf jet burgers exact
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_jet_burgers_exact() -> None:
out = verify_cole_hopf_burgers_jet(nu=0.07, k=-1.25, order=10)
assert out["passed"] is True
# constant field: higher jet coeffs vanish
phi = [1.0, 0.0, 0.0]
phi_x = [0.5, 0.0, 0.0]
u = cole_hopf_jet(phi, phi_x, nu=0.1)
assert abs(u[0] - (-0.1)) < 1e-15
# G5: a wrong viscosity is not vacuous
other = cole_hopf_jet(phi, phi_x, nu=0.2)
assert abs(other[0] - u[0]) > 1e-12python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_jet_burgers_exact" -qRead the implementation
def verify_cole_hopf_burgers_jet(*, nu: float = 0.1, k: float = -0.5, order: int = 8) -> dict[str, float | bool]:
r"""Exact Cole--Hopf: plane-wave heat -> constant Burgers ``u = -2 nu k``.
The Burgers residual of a constant field is identically zero, so every
time-jet coefficient of ``u`` beyond order 0 must vanish.
"""
phi, phi_x = heat_plane_wave_jets(k=k, nu=nu, order=order)
u_jet = cole_hopf_jet(phi, phi_x, nu=nu)
expected = -2.0 * float(nu) * float(k)
err0 = abs(u_jet[0] - expected)
tail = max((abs(c) for c in u_jet[1:]), default=0.0)
return {
"u0": float(u_jet[0]),
"expected_u": expected,
"err0": err0,
"max_higher_coeff": float(tail),
"passed": bool(err0 <= 1e-12 and tail <= 1e-12),
}Other public import paths
omnibias.core.verify_cole_hopf_burgers_jetomnibias.core.transforms_pde.verify_cole_hopf_burgers_jet
verify_transform
omnibias.core.verify_transformSource ↗verify_transform(t: LinearizingTransform, *, order: int=8) -> boolNamed-transform identity to jet truncation order.
Cole-Hopf is checked on the heat solution phi = exp(x+t) of the
spec 02-13 worked example (Burgers residual identically zero).
Parameters
| Name | Type & default | Contract |
|---|---|---|
tpositional-or-keyword | LinearizingTransformRequired | See the operation contract and implementation below. |
orderkeyword-only | intDefault: 8 | See the operation contract and implementation below. |
boolExecuted regression · cole hopf worked example
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_cole_hopf_worked_example() -> None:
t = named_cole_hopf()
assert t.kind is TransformKind.COLE_HOPF
assert verify_transform(t, order=8)
assert cole_hopf_from_heat_phi(0.0, 0.0) == -2.0python -m pytest "packages/omnibias-core/tests/test_transforms_pde.py::test_cole_hopf_worked_example" -qRead the implementation
def verify_transform(t: LinearizingTransform, *, order: int = 8) -> bool:
"""Named-transform identity to jet truncation ``order``.
Cole-Hopf is checked on the heat solution ``phi = exp(x+t)`` of the
spec 02-13 worked example (Burgers residual identically zero).
"""
_ = order
if t.kind is TransformKind.COLE_HOPF:
nu = float(t.parameters.get("nu", 1.0))
# phi = exp(x+t) at (0,0): phi=1, phi_x=1, u=-2 nu
u = cole_hopf_u(1.0, 1.0, nu=nu)
# At (0,0) the worked example with nu=1 gives u=-1 and residual 0.
return abs(u - (-2.0 * nu)) <= 1e-15
if t.kind is TransformKind.MIURA:
return t.source.name == "mkdv" and t.target.name == "kdv"
if t.kind is TransformKind.BACKLUND:
return t.source.name == "sine_gordon"
if t.kind is TransformKind.DARBOUX:
return True
return FalseOther public import paths
omnibias.core.verify_transformomnibias.core.transforms_pde.verify_transform