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_termMethod
_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.

source
MORFE.Realification._reorder_canonicalMethod
_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] = j means variable i is conjugate to variable j.
  • If variable i is real, then conj_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.

source
MORFE.Realification.compose_linearMethod
compose_linear(poly::DensePolynomial, M::Matrix{TA}) where TA -> DensePolynomial

Compose a multivariate polynomial with a linear map.

Arguments

  • poly: polynomial in variables x₁, …, x_n. (The coefficient type can be numeric or array‑valued.)
  • M: an n × p matrix. Composition means replacing x_i by ∑_{j=1}^p M[i,j] * y_j, where y₁, …, y_p are new variables.

Returns

A new polynomial in the variables y₁, …, y_p. The returned polynomial has the same coefficient type as the input poly.

source
MORFE.Realification.realifyMethod
realify(poly::DensePolynomial, conj_map::Vector{Int}) -> DensePolynomial

Transform a complex‑valued polynomial (with variables that may be conjugate pairs) into a polynomial in real variables.

Arguments

  • poly: a polynomial in variables z₁, …, z_N.
  • conj_map: a vector of length N where conj_map[i] = j means variable i is the conjugate of variable j; if i is real, then conj_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).

source
MORFE.Realification.realify_via_linearMethod
realify_via_linear(poly::DensePolynomial, conj_map::Vector{Int}) -> DensePolynomial

Transform 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

source