plumial.core.D._D.encode
- _D.encode(basis=None, g=None, h=None)[source]
Create a new D object encoded in a different basis.
This method enables the transitive encoding property where D objects can be transformed between different coordinate systems while preserving the underlying mathematical structure.
- Parameters:
basis (
Optional[Basis]) – Target basis for encodingg (
Union[int,float,None]) – g parameter for custom basis (alternative to basis parameter)h (
Union[int,float,None]) – h parameter for custom basis (alternative to basis parameter)
- Return type:
- Returns:
New D object with same n,o values but different basis
Examples
>>> d = D(2, 5) # Symbolic basis >>> collatz_d = d.encode(B.Collatz) # Collatz basis >>> custom_d = d.encode(g=5, h=2) # Custom basis >>> back_d = collatz_d.encode() # Back to symbolic basis >>> assert back_d == d # Round-trip equality