levisim.multiphysics.hybridisation¶
Power-series expansion of the hybridisation matrix H = D⁻¹ in terms of the hybridisation functions
- class levisim.multiphysics.hybridisation.HybridisationTerm(sign, pairs)[source]¶
Bases:
_HybridisationTermFieldsOne signed product of hybridisation functions, e.g. -Rx1y1(ω)·Ry1x1(ω)
sign is +1 or -1 and pairs is a tuple of (origin, destination) dimension-label pairs, one per hybridisation function Rjn,km in the product; an empty pairs is the constant +1 term. The number of pairs is the term’s order in the power series. The frequency-dependent value is evaluated by MultiTrap.hybridisation_term_value.
Still a namedtuple subclass, so it is immutable, hashable (pairs is stored as a tuple of tuples) and pickles by name. The power-series pickles under levisim/multiphysics/power_series_data/ were written when HybridisationTerm was a plain namedtuple with pairs as a list; protocol-4 unpickling calls HybridisationTerm.__new__, which converts those lists to tuples, so the old files load as instances of this class. [·]
- property order¶
Order of the term, i.e. the number of hybridisation functions in the product
- property leading_dimensions¶
The origin label of each hybridisation function in the product, in order
- levisim.multiphysics.hybridisation.term_string(term)[source]¶
Generates a string that represents the hybridistaion term e.g. Rx1y1.Ry1x2.Rx2x1
- levisim.multiphysics.hybridisation.term_latex(term, with_ω=True)[source]¶
Generates latex that represents the hybridistaion term e.g.
R_{x_{1} y{1}} \cdot R_{y{1}x{2}} \cdot R_{x{2}x{1}}
- levisim.multiphysics.hybridisation.alphabetic_subscript(index)[source]¶
The subscript of the dimension with 0-based index: ‘a’, …, ‘z’, then ‘aa’, ‘ab’, …, ‘az’, ‘ba’, …, ‘zz’, ‘aaa’, … (as spreadsheet columns), so any number of dimensions has unique subscripts and the first 26 are the single letters used before
- levisim.multiphysics.hybridisation.generate_subscripts_and_labels(num_traps, Cartesian_axes_per_trap)[source]¶
Generates:
- the unique subscripts for the hybridisation functions, as a list e.g. ['a', 'b', 'c', 'd'] for 4 total dimensions; after 'z' they continue 'aa', 'ab', ... (see `alphabetic_subscript`), so there is no limit of 26 dimensions - the unique labels of the form e.g. ['x1' 'y1', 'x2', 'y2'] for 2 particles xyPossible combinations (up to 10 total dimensions)
10 = 10 particles, x (10x1) 10 = 5 particles, xy (5x2) 9 = 9 particles, x (9x1) 9 = 3 particles, xyz (3x3) 8 = 8 particles, x (8x1) 8 = 4 particles, xy (4x2) 7 = 7 particles, x (7x1) 6 = 6 particles, x (6x1) 6 = 3 particles, xy (3x2) 6 = 2 particles, xyz (2x3) 5 = 5 particles, x (5x1) 4 = 4 particles, x (4x1) 4 = 2 particles, xy (2x2) 3 = 3 particles, x (3x1) 3 = 1 particle, xyz (1x3) 2 = 2 particles, x (2x1) 2 = 1 particle, xy (1x2) 1 = 1 particle, x (1x1)
- levisim.multiphysics.hybridisation.symmetric_group_with_min_fixed_points(order, min_fixed_points, begin_with_first_item=None)[source]¶
Generator for the symmetric group that produces permutations with a minimum number of fixed points
- levisim.multiphysics.hybridisation.generate_deranged_terms(n, i=None, j=None, dimension_labels=None, max_order=None, debug=False)[source]¶
Generates the power-series terms of the determinant, or of one adjugate entry, of the derangement matrix D = I - R of an n-dimensional system
With i, j both None this is det(D); otherwise it is adjugate entry (i, j). The determinant and the diagonal adjugate entries are sums over partial derangements (permutations of n, or n - 1, items with their fixed points dropped); the off-diagonal entries are sums over ‘path-cycles’ from dimension i to dimension j. max_order keeps only terms with at most that many hybridisation functions (None or 0 keeps all of them).
NOTE: terms are generated in lexicographic permutation order for every max_order. Before November 2026 a falsy max_order used sympy’s Schreier-Sims ordering instead, which gives the same set of terms in a different order (and failed outright for n = 1 adjugate entries); MultiTrap always passes a max_order, so its spectra are unaffected.
To build the determinant and all n² adjugate entries together, use generate_determinant_and_adjugate_terms, which enumerates each symmetric group only once. [list of HybridisationTerm]
- levisim.multiphysics.hybridisation.generate_determinant_and_adjugate_terms(n, labels, max_order=None)[source]¶
Generates the determinant terms and all n² adjugate-entry terms of the derangement matrix in a single pass over each symmetric group
S_n is enumerated once for the determinant and S_(n-1) once for all n² adjugate entries: every adjugate entry is a relabelling of the same permutations of n - 1 items, so their fixed points and cycles are computed once and reused. Returns the same lists, in the same order, as calling generate_deranged_terms once per entry. [(list of HybridisationTerm, {‘x1y1’: list of HybridisationTerm, …})]
- levisim.multiphysics.hybridisation.generate_all_hybridisation_functions(labels, sign=1)[source]¶
Generate a list of all the hybridisation functions given a list of dimension labels
- levisim.multiphysics.hybridisation.generate_determinant_and_adjugate_by_order(n, labels, max_order=None)[source]¶
Generate the determinant and adjugate terms for the hybridisation matrix, by order
Builds the full power series up to max_order (default n) with generate_determinant_and_adjugate_terms, then truncates it down to order 1, so that result[order] holds every term with at most order hybridisation functions. [({order: list}, {order: {‘x1y1’: list, …}})]
- levisim.multiphysics.hybridisation.truncate_power_series(power_series, truncation_power)[source]¶
Truncates a power_series (an iterable of HybridisationTerm`s) leaving only terms of order up to `truncation_power