Realification
Transforms complex-valued multivariate polynomials into equivalent real-valued polynomials. Useful when complex normal coordinates appear in dynamical systems but the final equations must be expressed in real variables.
MORFE.Realification._realify_term — Method
_realify_term(exp_vec::SVector{N,Int}, coeff::C, n::Int)
-> Dict{SVector{N,Int}, C} where {C,N}Transform a single term (exponent vector exp_vec and coefficient coeff) of a polynomial in the canonical form (z, z̄, w) into a sum of real monomials. Returns a dictionary mapping new exponent vectors (in the real variables) to their coefficients.
Here N = 2n + m, with n conjugate pairs and m real variables.
MORFE.Realification._reorder_canonical — Method
_reorder_canonical(poly::DensePolynomial{C,N}, conj_map::Vector{Int})
-> (DensePolynomial{C,N}, n, m)Reorder variables according to a conjugation map conj_map of length N (where N = number of variables).
conj_map[i] = jmeans variableiis conjugate to variablej.- If variable
iis real, thenconj_map[i] = i.
The reordering groups variables as (z₁, …, zₙ, conj(z₁), …, conj(zₙ), w₁, …, wₘ) where n is the number of conjugate pairs and m the number of real variables. Terms with the same exponent after reordering are merged.
Returns the canonical polynomial (same concrete type as poly), n, and m.
MORFE.Realification.compose_linear — Method
compose_linear(poly::DensePolynomial, M::Matrix{TA}) where TA -> DensePolynomialCompose a multivariate polynomial with a linear map.
Arguments
poly: polynomial in variablesx₁, …, x_n. (The coefficient type can be numeric or array‑valued.)M: ann × pmatrix. Composition means replacingx_iby∑_{j=1}^p M[i,j] * y_j, wherey₁, …, y_pare new variables.
Returns
A new polynomial in the variables y₁, …, y_p. The returned polynomial has the same coefficient type as the input poly.
MORFE.Realification.realify — Method
realify(poly::DensePolynomial, conj_map::Vector{Int}) -> DensePolynomialTransform a complex‑valued polynomial (with variables that may be conjugate pairs) into a polynomial in real variables.
Arguments
poly: a polynomial in variablesz₁, …, z_N.conj_map: a vector of lengthNwhereconj_map[i] = jmeans variableiis the conjugate of variablej; ifiis real, thenconj_map[i] = i.
Returns
A new polynomial in real variables x₁, …, x_n, y₁, …, y_n, w₁, …, w_m with n conjugate pairs and m real variables. The transformation uses the formulas z = x + i y, z̄ = x - i y. The returned polynomial has the same concrete type as the input poly (including the same number of variables).
MORFE.Realification.realify_via_linear — Method
realify_via_linear(poly::DensePolynomial, conj_map::Vector{Int}) -> DensePolynomialTransform a complex‑valued polynomial into a polynomial in real variables by composing with the linear map that expresses complex variables in terms of real and imaginary parts. This is an alternative implementation to realify that uses the compose_linear function. The returned polynomial has the same concrete type as the input poly (real coefficients).
See also: realify, compose_linear