Computational Aspects of Quaternionic Polynomials

Part I: Manipulating, Evaluating and Factoring

M. Irene Falcão
Fernando Miranda
Ricardo Severino
M. Joana Soares

This article discusses a recently developed Mathematica tool–QPolynomial–a collection of functions for manipulating, evaluating and factoring quaternionic polynomials. QPolynomial relies on the package QuaternionAnalysis, which is available for download at w3.math.uminho.pt/QuaternionAnalysis.

Introduction

Some years ago, the first two authors of this article extended the standard Mathematica package implementing Hamilton’s quaternion algebra—the package Quaternions—endowing it with the ability, among other things, to perform numerical and symbolic operations on quaternion-valued functions []. Later on, the same authors, in response to the need for including new functions providing basic mathematical tools necessary for dealing with quaternionic-valued functions, wrote a full new package, Quaternion Analysis. Since 2014, the package and complete support files have been available for download at the Wolfram Library Archive (see also [] for updated versions).

Over time, this package has become an important tool, especially in the work that has been developed by the authors in the area of quaternionic polynomials ([–]). While this work progressed, new Mathematica functions were written to appropriately deal with problems in the ring of quaternionic polynomials. The main purpose of the present article is to describe these Mathematica functions. There are two parts.

In this first part, we discuss the QPolynomial tool, containing several functions for treating the usual problems in the ring of quaternionic polynomials: evaluation, Euclidean division, greatest common divisor and so on. A first version of QPolynomial was already introduced in [], having in mind the user’s point of view. Here, we take another perspective, giving some implementation details and describing some of the experiments performed.

The second part of the article (forthcoming) is entirely dedicated to root-finding methods.

The QuaternionAnalysis Package and the Algebra of Real Quaternions

In 1843, the Irish mathematician William Rowan Hamilton introduced the quaternions, which are numbers of the form

q=(Subscript[q, 0])+(Subscript[q, 1])i+(Subscript[q, 2])j+(Subscript[q, 3])k,(Subscript[q, i])∈ℝ,

where the imaginary units i, j and k satisfy the multiplication rules

(i^2)=(j^2)=(k^2)=i j k=-1.

This noncommutative product generates the well-known algebra of real quaternions, usually denoted by ℍ.

Definition 1

In analogy with the complex case, we define:

The standard package Quaternions adds rules to Plus, Minus, Times, Divide and the fundamental NonCommutativeMultiply. Among others, the following quaternion functions are included: Re, Conjugate, AbsIJK, Sign, AdjustedSignIJK, ToQuaternion, FromQuaternion and QuaternionQ. In Quaternions, a quaternion is an object of the form Quaternion[x0,x1,x2,x3] and must have real numeric valued entries; that is, applying the function NumericQ to an argument gives True.

The extended version QuaternionAnalysis allows the use of symbolic entries, assuming that all symbols represent real numbers. The QuaternionAnalysis package adds functionality to the following functions: Plus, Times, Divide, Power, Re, Conjugate, Dot, Abs, Norm, Sign and Derivative. We briefly illustrate some of the quaternion functions needed in the sequel. In what follows, we assume that the package QuaternionAnalysis has been installed.

Needs["QuaternionAnalysis`"]

These are the imaginary units.

qi=Quaternion[0,1,0,0];
qj=Quaternion[0,0,1,0];
qk=Quaternion[0,0,0,1];

These are the multiplication rules.

qj**qj

qi**qj**qk

Here are two quaternions with symbolic entries and their product.

p=Quaternion[p0,p1,p2,p3];
q=Quaternion[q0,q1,q2,q3];
p**q

The product is noncommutative.

q**p

p**q-q**p

Here are some basic functions.

Re[p]

Vec[p]

Re[p]+Vec[p]

Conjugate[p]//TraditionalForm

The function Power, which was extended in Quaternions through the use of de Moivre’s formula for quaternions, works quite well for quaternions with numeric entries.

Power[Quaternion[1,1,0,1],2]

QuaternionAnalysis contains a different implementation of the power function, QPower, which we recommend whenever a quaternion has symbolic entries.

QPower[p,2]

We refer the reader to the package documentation for more details on the new functions included in the package.

?QuaternionAnalysis`*

Manipulating Quaternionic Polynomials

We focus now on the polynomial P in one formal variable x of the form

P(x)=(Subscript[a, n])(x^n)+(Subscript[a, n-1])(x^(n-1))+…+(Subscript[a, 1])x+(Subscript[a, 0,]) (Subscript[a, n])≠0,

where the coefficients (Subscript[a, k])∈ℍ are to the left of the powers. Denote by ℍ[x] the set of polynomials of the form (), defining addition and multiplication as in the commutative case and assuming the variable x commutes with the coefficients. This is a ring, referred to as the ring of left one-sided (or unilateral) polynomials.

When working with the functions contained in QPolynomial, a polynomial P(x) in ℍ[x] is an object defined through the use of the function Polynomial, which returns the simplest form of P(x), taking into account the following rules.

Polynomial[a_?ScalarQ]:=a

Polynomial[a_Quaternion]:=a

Polynomial[0..]=0;

Polynomial[Longest[PatternSequence[0]..],x__]:=Polynomial[x]

The function ScalarQ tests if an argument is a scalar in the sense that it is not a complex number, a quaternion number or a polynomial.

ScalarQ[x_]:=Apply[And,Head[x]=!=#&/@{Complex,Quaternion,Polynomial}]

For polynomials in ℍ[x], the rules Plus, Times, NonCommutativeMultiply and Power have to be defined.

◼ Addition

Polynomial/:Plus[sc_?ScalarQ,p_Polynomial]:=Polynomial@@Plus@@@Transpose@PadLeft[{{sc},List@@p}]

Polynomial/:Plus[sc_Quaternion,p_Polynomial]:=Polynomial@@Plus@@@Transpose@PadLeft[{{sc},List@@p}]

Polynomial/:Plus[p1_Polynomial,p2_Polynomial]:=Polynomial@@Plus@@@Transpose@PadLeft[{List@@p1,List@@p2}]

◼ Product by a scalar

Polynomial/:Times[sc_?ScalarQ,p_Polynomial]:=Map[sc #&,p]

◼ Multiplication

Polynomial/:NonCommutativeMultiply[sc_Quaternion,p_Polynomial]:=Map[sc **#&,p]

Polynomial/:NonCommutativeMultiply[p_Polynomial,sc_Quaternion]:=Map[ #**sc&,p]

Polynomial/:NonCommutativeMultiply[p1_Polynomial,p2_Polynomial]:=Module[{dim1=Length@p1,dim2=Length@p2},
Polynomial@@Plus@@@Transpose[PadRight[MapThread[PadLeft,{Transpose[Outer[NonCommutativeMultiply,List@@p1,List@@p2]],Range[dim1,dim1+dim2-1]}]]]]

◼ Power

Polynomial/:Power[p_Polynomial,n_Integer?Positive]:=Nest[NonCommutativeMultiply[p,#]&,p,n-1]

Example 1

The polynomials P(x)=(x^2)+(1+i-j)x+k and Q(x)=x+(2i-j+k) can be defined using their coefficients in Polynomial in descending order.

px=Polynomial[1,Quaternion[1,1,-1,0],Quaternion[0,0,0,1]];
qx=Polynomial[1,Quaternion[0,2,-1,1]];

px+2qx

Quaternion[1,1,1,1]**px

px**qx

(px^3)

We now define three particularly important polynomials, the first two associated with a given polynomial P and the last one associated with a given quaternion q.

Definition 2

With P a polynomial as in equation () and q a quaternion, define:

The first two polynomials are constructed with the functions Conjugate and CompanionPolynomial.

Polynomial/:Conjugate[p_Polynomial]:=Conjugate/@p

CompanionPolynomial[p_Polynomial]:=p**Conjugate[p]

The built-in function CharacteristicPolynomial now accepts a quaternion argument.

Unprotect[CharacteristicPolynomial];
CharacteristicPolynomial[q_?ScalarQ]:=Polynomial[1,-q]^2;
Quaternion/:CharacteristicPolynomial[q_Quaternion]:=Polynomial[1,-q]**Polynomial[1,-Conjugate[q]]
SyntaxInformation[CharacteristicPolynomial]={"ArgumentsPattern"->{_,_.}};
Protect[CharacteristicPolynomial];

Observe that (Subscript[C, P]) is a polynomial with real coefficients. For simplicity, in this context and in what follows, we assume that a quaternion with vector part zero is real.

Quaternion[a_,0,0,0]:=a

Example 2

Consider the polynomial P(x) of Example 1 and the quaternion t=2i-j+k.

Conjugate@px

CompanionPolynomial@px

t=Quaternion[0,2,-1,1];
CharacteristicPolynomial[t]

Evaluating Quaternionic Polynomials

The evaluation map at a given quaternion α, defined for the polynomial P(x) given by (), is

P(α)=(Subscript[a, n])(α^n)+(Subscript[a, n-1])(α^(n-1))+…+(Subscript[a, 1])α+(Subscript[a, 0]).

It is not an algebra homomorphism, as P(x)=L(x)R(x) does not lead, in general, to  P(α)=L(α)R(α), as the next theorem remarks.

Theorem 1

Let L(x)=(∑_(i=0)^n)(Subscript[a, i])(x^i) and R(x)=(∑_(j=0)^m)(Subscript[b, j])(x^j) be two polynomials in ℍ[x] and consider the polynomial P(x)=L(x)R(x) and α∈ℍ. Then:

As usual, we say that α is a zero (or root) of P(x) if P(α)=0. An immediate consequence of Theorem 1 is that if R(α)≠0, then α is a zero of P(x) if and only if R(α)α (((R(α)))^(-1)) is a zero of L(x).

A straightforward implementation of equation () can be obtained through Eval.

Eval[p_Polynomial]:=Plus@@MapThread[NonCommutativeMultiply,{List@@p,Reverse@Function[x,NestList[(#**x)&,1,Length@p-1]][#]}]&

Eval[p_Polynomial,x_]:=Eval[p][x]

As in the classical (real or complex) case, the evaluation of a polynomial can also be obtained by the use of Horner’s rule []. The nested form of equation () is

P(α)=((…((Subscript[a, n])α+(Subscript[a, n-1]))α+…)α+(Subscript[a, 1]))α+(Subscript[a, 0]),

and the quaternionic version of Horner’s rule can be implemented as HornerEval.

HornerEval[p_Polynomial,x_]:=Fold[NonCommutativeMultiply[#1,x]+#2&,0,p]

Example 3

Consider again the polynomial P(x)=(x^2)+(1+i-j)x+k. The problem of evaluating P(x) at t=2i-j+k can be solved through one of the following (formally) equivalent expressions.

Eval[px,t]

HornerEval[px,t]

Example 4

We now illustrate some of the conclusions of Theorem 1 by considering the polynomials L(x)=x-i+k, R(x)=x-1-j+k and S(x)=x-2 and the quaternion u=i-k.

lx=Polynomial[1,Quaternion[0,-1,0,1]];
rx=Polynomial[1,Quaternion[-1,0,-1,1]];sx=Polynomial[1,-2];u=Quaternion[0,1,0,-1];

px1=lx**rx;
Eval[px1][u]===Eval[lx][u]**Eval[rx][u]

Eval[px1][Abs@u]===Eval[lx][Abs@u]**Eval[rx][Abs@u]

px2=sx**rx;
Eval[px2][u]===Eval[rx][u]**Eval[sx][u]

The Euclidean Algorithm

For the theoretical background of this section, we refer the reader to [] (see also [] where basic division algorithms in ℍ[x] are presented). Since ℍ[x] is a principal ideal domain, left and right division algorithms can be defined. The following theorem gives more details.

Theorem 2—Euclidean division

If (Subscript[P, 1])(x) and (Subscript[P, 2])(x) are polynomials in ℍ[x] (with 0<deg (Subscript[P, 2])≤deg (Subscript[P, 1])), then there exist unique (Subscript[Q, left])(x), (Subscript[R, left])(x), (Subscript[Q, right])(x) and (Subscript[R, right])(x) such that

(Subscript[P, 1])(x)=(Subscript[Q, left])(x)(Subscript[P, 2])(x)+(Subscript[R, left])(x)

(Subscript[P, 1])(x)=(Subscript[P, 2])(x)(Subscript[Q, right])(x)+(Subscript[R, right])(x),

If in equation (), (Subscript[R, left])(x)=0, then (Subscript[P, 2])(x) is called a right divisor of (Subscript[P, 1])(x), and if in equation (), (Subscript[R, right])(x)=0, (Subscript[P, 2])(x) is called a left divisor of (Subscript[P, 1])(x). This article only presents right versions of the division functions; in QPolynomial both the left and right versions are implemented. The function PolynomialDivisionR performs the right division of two quaternionic polynomials, returning a list with the quotient and remainder of the division.

PolynomialDivisionR[p1_Polynomial,sc_?ScalarQ]:={p1/sc,0}

PolynomialDivisionR[p1_Polynomial,sc_Quaternion]:={p1**(1/sc),0}

PolynomialDivisionR[p1_Polynomial,p2_Polynomial]:=Module[{tt,qq=0,rr=p1,degree=Length@p1-Length@p2},
While[
Head@rr===Polynomial&&degree≥0,tt=Polynomial@@(PadRight[{First@rr**(1/First@p2)},degree+1]);
qq=qq+tt;
rr=rr-tt**p2;
degree=Length[rr]-Length[p2]
];
{qq,rr}]

Example 5

Consider the polynomials (Subscript[P, 1])(x)=(x^2)+(-1+i-k)x+2+2j+2k and (Subscript[P, 2])(x)=x-2k.

px1=Polynomial[1,Quaternion[-1,1,0,-1],Quaternion[2,0,2,2]];
px2=Polynomial[1,Quaternion[0,0,0,-2]];
PolynomialDivisionR[px1,px2]

px3=Polynomial[1,Quaternion[-1,1,0,1]];
PolynomialDivisionR[px1,px3]

GCDR[a_,0]= a;

GCDR[a_,b_]:=GCDR[b, Last[PolynomialDivisionR[a,b]]]

GCDR[a_,b_,c__]:=GCDR[GCDR[a,b],c]

PolynomialGCDR[a_,b_,c___]:=PNormalizeL[GCDR[a,b,c]]

PNormalizeL[0]=0;

PNormalizeL[sc_?ScalarQ]:=(1/sc)**sc

PNormalizeL[sc_Quaternion]:=1

PNormalizeL[p_Polynomial]:=(1/First@p)**p

Example 5 (continued)

GCDR((Subscript[P, 1]),(Subscript[P, 2]))=(Subscript[P, 2]) and GCDR((Subscript[P, 1]),(Subscript[P, 2]),(Subscript[P, 3]))=1.

PolynomialGCDR[px1,px2]

The Zero Structure in ℍ(x)

Before describing the zero set (Subscript[ℤ, P]) of a quaternionic polynomial P, we need to introduce more concepts.

Definition 3

We say that a quaternion  q is congruent (or similar) to a quaternion r (and write q∼r) if there exists a nonzero quaternion h such that r=h q (h^(-1)).

This is an equivalence relation in ℍ[x] that partitions ℍ[x] into congruence classes. The congruence class containing a given quaternion q is denoted by [q]. It can be shown (see, e.g. []) that

[q]={r∈ ℍ: Re q=Re r and ||r||=||q||}.

This result gives a simple way to test if two or more quaternions are similar, implemented with the function SimilarQ.

SimilarQ[q_Quaternion,r_Quaternion]:=ZeroQ[Re@q-Re@r] &&ZeroQ[Norm@q-Norm@r]

For zero or equality testing, we use the ZeroQ test function.

ZeroQ[a_]:=PossibleZeroQ[a,Method->"ExactAlgebraics"]

ZeroQ[q_Quaternion]:=And@@ZeroQ/@q

q5=Quaternion[1,2,3,4];q6=Quaternion[1,3,4,2];q7=Quaternion[-1,2,3,4];
SimilarQ[q5,q6]

SimilarQ[q6,q7]

It follows that [q]={q} if and only if q∈ℝ. The congruence class of a nonreal quaternion q=(Subscript[q, 0])+(Subscript[q, 1])i+(Subscript[q, 2])j+(Subscript[q, 3])k can be identified with the three-dimensional sphere in the hyperplane {((Subscript[x, 0]),(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3]))∈(ℝ^4): (Subscript[x, 0])=(Subscript[q, 0])} with center ((Subscript[q, 0]),0,0,0) and radius (Sqrt[((Subscript[q, 1])^2)+((Subscript[q, 2])^2)+((Subscript[q, 3])^2)]).

Definition 4

A zero q of P∈ ℍ[x] is called an isolated zero of P if [q] contains no other zeros of P. Otherwise, q is called a spherical zero of P and [q] is referred to as a sphere of zeros.

It can be proved that if q is a zero that is not isolated, then all quaternions in [q] are in fact zeros of P (see Theorem 4); therefore the choice of the term spherical to designate this type of zero is natural. According to the definition, real zeros are always isolated zeros. Identifying zeros can be done, taking into account the following results.

Theorem 3 ([])

Let P∈ ℍ[x] and α∈ℍ. The following conditions are equivalent:

Theorem 4 ([], [])

A nonreal zero α is a spherical zero of P∈ ℍ[x] if and only if any of the following equivalent conditions hold:

Example 6

We are going to show that the polynomial

P(x)=(x^3)+(1-i+j) (x^2)+2 x+2-2i+2j

has a spherical zero: i+j and an isolated one: -1+i-j.

px4=Polynomial[1,Quaternion[1,-1,1,0],2,Quaternion[2,-2,2,0]];
sph=Quaternion[0,1,1,0];
iso=Quaternion[-1,1,-1,0];

We first observe that both sph and iso are zeros of P.

Eval[px4][sph]

Eval[px4][iso]

Now we use Theorem 4-1 to conclude that the zero sph is spherical, while the zero iso is isolated.

Eval[px4][Conjugate@sph]

Eval[px4][Conjugate@iso]

We can reach the same conclusion from Theorem 4-3.

PolynomialDivisionR[px4,CharacteristicPolynomial[sph]]

PolynomialDivisionR[px4,CharacteristicPolynomial[iso]]

Taking all this into account, the verification of the nature of a zero can be done using the function SphericalQ.

SphericalQ[p_Polynomial,q_Quaternion]:=ZeroQ[Eval[p][q]]&&ZeroQ[Eval[p][Conjugate@q]]

Consider the same polynomial and quaternions again.

SphericalQ[px4,sph]

SphericalQ[px4,iso]

We now list other results needed in the next section.

Theorem 5—Factor theorem ([], [])

Let P∈ ℍ[x] and α∈ℍ. Then α is a zero of P if and only if there exists Q∈ℍ[x] such that P(x)=Q(x)(x-α).

Theorem 6—Fundamental theorem of algebra ([])

Any nonconstant polynomial in ℍ[x] always has a zero in ℍ.

Factoring

In this section, we address the problem of factoring a polynomial P. We mostly follow []. As in the classical case, it is always possible to write a quaternionic polynomial as a product of linear factors; however the link between these factors and the corresponding zeros is not straightforward. As an immediate consequence of Theorems 5 and 6, one has the following theorem.

Theorem 7—Factorization into linear terms

Any monic polynomial P of degree n≥1 in ℍ[x] factors into linear factors; that is, there exist (Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])∈ℍ such that

P(x)=(x-(Subscript[x, n]))(x-(Subscript[x, n-1]))… (x-(Subscript[x, 1])).

Definition 5

In a factorization of P of the form (), the quaternions (Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n]) are called factor terms of P and the n-tuple ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) is called a factor terms chain associated with P or simply a chain of P.

If ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) and ((Subscript[y, 1]),(Subscript[y, 2]),…,(Subscript[y, n])) are chains associated with the same polynomial P, then we say that the chains are similar and write ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n]))∼((Subscript[y, 1]),(Subscript[y, 2]),…,(Subscript[y, n])).

The function PolynomialFromChain constructs a polynomial with a given chain, and the function SimilarChainQ checks if two given chains are similar.

PolynomialFromChain[list_List]:=NonCommutativeMultiply@@(Polynomial[1,-#1]&)/@Reverse[list]

ZeroQ[p_Polynomial]:=And@@(ZeroQ/@p)

SimilarChainQ[c1_List,c2_List]:=ZeroQ[PolynomialFromChain[c1]-PolynomialFromChain[c2]]

The repeated use of the next result allows the constructions of similar chains, if any.

Theorem 8

Let ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, l-1]),(Subscript[x, l]),…,(Subscript[x, n])) be a chain of a polynomial P. If h=(OverBar[(Subscript[x, l])])-(Subscript[x, l-1])≠0, then

((Subscript[x, 1]),…,(h^(-1))(Subscript[x, l])h,(h^(-1))(Subscript[x, l-1])h,…,(Subscript[x, n]))∼((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, l-1]),(Subscript[x, l]),(Subscript[…x, n])).

Theorem 8 can be implemented using the function FactorShift.

FactorShift[{q1_,q2_}]:=Module[{
h=(Conjugate@q2-q1)},
If[ZeroQ@h,{q2,q1},{(1/h)**q2**h,(1/h)**q1**h}]
]

FactorShift[l_List,m_Integer?Positive,n_Integer?Positive]:=Module[
{lista=l,dim=Length@l,seq},
If[m>dim||n>dim,Message[FactorShift::args],seq=Sort/@Partition[Range[m,n,Sign[n-m]],2,1];
Map[(Part[lista,#]=FactorShift[Part[lista,#]])&,seq]];
lista
]

FactorShift::args="Chain too short.";

Example 7

This constructs chains similar to the chain (1+i+k,-1+j,i+j+k).

c1={Quaternion[1,1,0,1],Quaternion[-1,0,1,0],Quaternion[0,1,1,1]};

c2=FactorShift[c1,3,1]

c3=FactorShift[c1,1,3]

Observe that c1, c2 and c3 are similar chains.

SimilarChainQ[c1,c2]

SimilarChainQ[c2,c3]

We emphasize that there are polynomials with just one chain. This issue is addressed in Theorem 12. For the moment, we just give an example of such a polynomial.

c4={x4=Quaternion[0,1,0,0],x5=Quaternion[0,0,1,0],x6=Quaternion[0,0,0,1]};
FactorShift[c4,3,2]

FactorShift[c4,1,3]

PolynomialFromChain[c4]

Polynomial[1,-x6]**Polynomial[1,-x5]**Polynomial[1,-x4]

These computations lead us to the conclusion that the polynomial (x^3)-(i+j+k)(x^2)-(i-j+k)x-1 factors uniquely as (x-k)(x-j)(x-i).

The next fundamental results shed light on the relation between factor terms and zeros of a quaternionic polynomial.

Theorem 9 ([–])

Let ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) be a chain of the polynomial P. Then every zero of P is similar to some factor term (Subscript[x, k]) in the chain and conversely, every factor term (Subscript[x, k]) is similar to some zero of P.

Theorem 10—Zeros from factors ([])

Consider a chain ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) of the polynomial P. If the similarity classes [(Subscript[x, k])] are distinct, then P has exactly n zeros (Subscript[ζ, k]), which are given by:

(Subscript[ζ, k])=(OverBar[(Subscript[𝒫, k])])((Subscript[x, k]))(((Subscript[x, k])((OverBar[(Subscript[𝒫, k])])((Subscript[x, k]))))^(-1)); k=1,…,n,k=1,…,n,

(Subscript[𝒫, k])(x)=({{{, ({{1, if k=1,}, {(x-(Subscript[x, k-1]))… (x-(Subscript[x, 1])), otherwise.}})}})

The function ZerosFromChain determines the zeros of a polynomial with a prescribed chain in the case where no two factors in the chain are similar quaternions, giving a warning if this condition does not hold.

ZerosFromChain[fact_List]:=Module[
{n=Length@fact,factors=fact,roots={},RPoli,RPoliz},If[n>Length@Union@Map[{Re@#,Norm@#}&,fact],Message[ZerosFromChain::args],
For[i=1,i≤n,i++,
RPoli=RPol[factors,i];
RPoliz=Eval[RPoli][factors[[i]]];
AppendTo[roots,RPoliz**factors[[i]]**(1/RPoliz)];
];
roots
]]

ZerosFromChain::args="Arguments in the same similarity class.";

RPol[fact_,i_]:=Module[
{n=Length@fact},
Which[
i==1,Polynomial[1],
i==2,Polynomial[1,-Conjugate@#]&@@(Drop[fact,i-n-1]),
i≤n,(NonCommutativeMultiply@@(Polynomial[1,-Conjugate@#]&/@(Drop[fact,i-n-1])))
];
]

Example 8

Consider the polynomial P(x)=(x-i+j-k)(x+2k)(x-1)(x+1-i+j). One of its chains is (-1+i-j,1,-2k,i-j+k), and it follows at once that the similarity classes of the factor terms are all distinct. Therefore, we conclude from Theorem 10 that P has four distinct isolated roots, which can be obtained with the following code.

ZerosFromChain[{Quaternion[-1,1,-1,0],1,Quaternion[0,0,0,-2],Quaternion[0,1,-1,1]}]

On the other hand, the polynomial P(x)=(x-i)(x+2k)(x-j) has (j,-2k,i) as one of its chains. Since [i]=[j], one cannot apply Theorem 10 to find the roots of P.

ZerosFromChain[c5={Quaternion[0,0,1,0],Quaternion[0,0,0,-2],Quaternion[0,1,0,0]}]

Observe that this does not mean that the roots of P are spherical.

px5=PolynomialFromChain[c5]

Eval[px5][First@c5]

SphericalQ[px5,First@c5]

This issue will be resumed later in connection with the notion of the multiplicity of a zero. The following theorem indicates how, under certain conditions, one can construct a polynomial having prescribed zeros.

Theorem 11—Factors from zeros ([])

If (Subscript[ζ, 1]),…,(Subscript[ζ, n]) are quaternions such that the similarity classes [(Subscript[ζ, k])] are distinct, then there is a unique polynomial P of degree n with zeros (Subscript[ζ, 1]),…,(Subscript[ζ, n]) that can be constructed from the chain ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])), where

(Subscript[x, k])=(Subscript[𝒫, k])((Subscript[ζ, k]))(((Subscript[ζ, k])((Subscript[𝒫, k])((Subscript[ζ, k]))))^(-1)), k=1,…,n,

The function ChainFromZeros implements the procedure described in Theorem 11.

ChainFromZeros[root_List]:=Module[
{n=Length@root,factor,factors,QPoli=1,QPoliz},
If[n>Length@Union@Map[{Re@#,Norm@#}&,root],Message[ChainFromZeros::args1],
factor=First@root;factors={factor};
For[i=2,i≤n,i++,
QPoli=Polynomial[1,-factor]**QPoli;
QPoliz=Eval[QPoli][root[[i]]];
factor=QPoliz**root[[i]]**(1/QPoliz);
AppendTo[factors,factor];
];
factors
]]

ChainFromZeros::args1="Arguments in the same similarity class. Use an alternative syntax.";

Example 9

Consider the problem of constructing a polynomial having the isolated roots i, 1+i+k, -1+3j. We first determine one chain associated with these zeros.

chain=ChainFromZeros[roots={Quaternion[0,1,0,0],Quaternion[1,1,0,1],Quaternion[-1,0,3,0]}]

Now we determine the polynomial associated with this chain.

px6=PolynomialFromChain[chain]

Check the solution.

Eval[px6][roots]

Theorem 12 ([–])

Let P be a quaternionic polynomial of degree n. Then (Subscript[x, 1])∈ℍ \ ℝ is the unique zero of P if and only if P admits a unique chain ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) with the property

(Subscript[x, l])∈[(Subscript[x, 1])] and (Subscript[x, l])≠(Subscript[(OverBar[x]), l-1]),

Moreover, if a chain ((Subscript[x, 1]),(Subscript[x, 2]),…,(Subscript[x, n])) associated with a polynomial P has property (), Q is a polynomial of degree m such that (Subscript[y, 1])∈ℍ \ ℝ is its unique zero and (Subscript[y, 1])∉[(Subscript[x, 1])], then the polynomial P Q (of degree m+n) has only two zeros, namely (Subscript[x, 1]) and (OverBar[P])((Subscript[y, 1]))(((Subscript[y, 1])((OverBar[P])((Subscript[y, 1]))))^(-1)).

We can now introduce the concept of the multiplicity of a zero and a new kind of zero. In this context, we have to note that several notions of multiplicity are available in the literature (see [], [–]).

Definition 6

The multiplicity of a zero q of P is defined as the maximum degree of the right factors of P with q as their unique zero and is denoted by (Subscript[m, P])(q). The multiplicity of a sphere of zeros [q] of P, denoted by (Subscript[m, p])([q]), is the largest k∈(Subscript[ℕ, 0]) for which ((Subscript[Ψ, q])^k) divides P.

A zero q of P is called a mixed zero if (Subscript[m, p])([q])>0 and (Subscript[m, P])(q)>(Subscript[m, P])(q') for all q'∈[q].

Example 10

The polynomial P(x)=(x-k)(x-j)(x-1+i) has an isolated root (Subscript[q, 1])=1-i with multiplicity (Subscript[m, P])((Subscript[q, 1]))=1 and an isolated root (Subscript[q, 2])=j with multiplicity (Subscript[m, P])((Subscript[q, 2]))=1.

The polynomial P(x)=(x+j)(x-j)(x-1+i) has an isolated root (Subscript[q, 1])=1-i with multiplicity (Subscript[m, P])((Subscript[q, 1]))=1 and a sphere of zeros [(Subscript[q, 2])]=[j] with multiplicity (Subscript[m, P])([(Subscript[q, 2])])=1.

The polynomial P(x)=(x+j)(((x-j))^2) has a mixed root q=j with multiplicity (Subscript[m, P])(q)=2 and (Subscript[m, P])([q])=1.

Finally, one can construct a polynomial with assigned zeros by the repeated use of the following result.

Theorem 13 ([])

A polynomial with (Subscript[ζ, 1]) and (Subscript[ζ, 2]) as its isolated zeros with multiplicities m and n, respectively, and a sphere of zeros [(Subscript[ζ, s])] with multiplicity k can be constructed through the chain

(Overscript[((OverBar[(Subscript[ζ, 1])]),…,(Subscript[ζ, 1]), (Overscript[⏞,           m        ])]),(Overscript[(Subscript[(OverTilde[ζ]), 2]),…,(Subscript[(OverTilde[ζ]), 2]), (Overscript[⏞,            n        ])]),(Overscript[(Subscript[ζ, s]),(OverBar[(Subscript[ζ, s])]),…,(Subscript[ζ, s]),(OverBar[(Subscript[ζ, s])]) ), (Overscript[⏞,               2k                 ])])

An alternative syntax for the function ChainFromZeros addresses the problem of constructing a polynomial (in fact it constructs a chain) once one knows the nature and multiplicity of its roots.

ChainFromZeros[{},{}]:={}

ChainFromZeros[isoroots:{{_,_}..},{}]:=Module[
{nisoroots=Length@isoroots,factor,multiplicity,factors,QPoli=1,QPoliz},
If[nisoroots>Length@Union@Map[{Re@#,Norm@#}&,First@Transpose@isoroots],Message[ChainFromZeros::args2],
factor=isoroots[[1,1]];multiplicity=isoroots[[1,2]];factors=Table[factor,{multiplicity}];
For[i=2,i≤nisoroots,i++,
QPoli=Power[Polynomial[1,-factor],multiplicity]**QPoli;
QPoliz=Eval[QPoli][isoroots[[i,1]]];
factor=QPoliz**isoroots[[i,1]]**(1/QPoliz);multiplicity=isoroots[[i,2]];
factors=Join[factors,Table[factor,{multiplicity}]];
];
factors
]
]

ChainFromZeros[{},sphroots:{{_,_}..}]:=Module[
{nsphroots=Length@sphroots},
If[nsphroots>Count[sphroots,{_Quaternion,_}],Message[ChainFromZeros::args4],
If[nsphroots>Length@Union@Map[{Re@#,Norm@#}&,First@Transpose@sphroots],Message[ChainFromZeros::args3],Null];
Flatten@(Table[{#1,Conjugate@#1},{#2}]&@@@sphroots)
]
]

ChainFromZeros[isoroots:{{_,_}...},sphroots:{{_,_}...}]:=Module[
{ch1=ChainFromZeros[isoroots,{}],ch2=ChainFromZeros[{},sphroots]},
If[ch1=!=Null && ch2=!= Null,Join[ch1,ch2],Null]
]

ChainFromZeros::args2="Two or more isolated zeros are in the same similarity class.";
ChainFromZeros::args3="Two or more spherical zeros are in the same similarity class.";
ChainFromZeros::args4="Spherical zeros must be nonreals.";

Example 11

We reconsider here Example 6 of []. An example of a polynomial P that has (Subscript[ζ, 1])=i as a zero of multiplicity three, (Subscript[ζ, 2])=-1+j+k as a zero of multiplicity two and [2+i] as a sphere of zeros with multiplicity two is

P(x)=((((Subscript[Ψ, 2+i])^2)(x-(Subscript[x, 2])))^2)(((x-(Subscript[x, 1])))^3),

P(x)=(((x-2-i))^2)(((x-2+i))^2)(((x+1+(7/5)i+(1/5)j))^2)(((x-i))^3).

Of course this solution is not unique. For example, the polynomial

Q(x)=(((x-2-i))^2)(((x-2+i))^2)(x+1-j-k)(x+1+(7/5)i+(1/5)j)(x-k)(x-j)(x-i)

We confirm this using the function ChainFromZeros with the new syntax.

ChainFromZeros[{{Quaternion[0,1,0,0],3},{Quaternion[-1,0,1,1],2}},{{Quaternion[2,1,0,0],2}}]

ChainFromZeros[{{Quaternion[0,1,0,0],1}},{{Quaternion[0,1,0,0],1}}]

PolynomialFromChain[%]

Here are two spherical roots corresponding to the same sphere.

ChainFromZeros[{},{{Quaternion[0,1,0,0],1},{Quaternion[0,0,1,0],1}}]

PolynomialFromChain[%]

Observe that the result is, of course, the same as this one.

PolynomialFromChain[ChainFromZeros[{},{{Quaternion[0,1,0,0],2}}]]

Recall that a real root is always an isolated root, and two roots in the same congruence class cannot be isolated.

ChainFromZeros[{{Quaternion[0,1,0,0],2},{Quaternion[0,0,1,0],2}},{{Quaternion[1,1,0,0],3},{2,2}}]

Conclusion

This article has discussed implementation issues related to the manipulation, evaluation and factorization of quaternionic polynomials. We recommend that interested readers download the support file QPolynomial.m to get complete access to all the implemented functions. The increasing interest in the use of quaternions in areas such as number theory, robotics, virtual reality and image processing [] makes us believe that developing a computational tool for operating in the quaternions framework will be useful for other researchers, especially taking into account the power of Mathematica as a symbolic language.

In the ring of quaternionic polynomials, new problems arise mainly because the structure of zero sets, as we have described, is very different from the complex case. In this article, we did not discuss the problem of computing the roots or the factor terms of a polynomial; all the results we have presented assumed that either the zeros or the factor terms of a given polynomial are known. Methods for computing the roots or factor terms of a quaternionic polynomial are considered in Part II.

Acknowledgments

Research at the Centre of Mathematics at the University of Minho was financed by Portuguese Funds through FCT - Fundação para a Ciência e a Tecnologia, within the Project UID/MAT/00013/2013. Research at the Economics Politics Research Unit was carried out within the funding with COMPETE reference number POCI-01-0145-FEDER-006683 (UID/ECO/03182/2013), with the FCT/MEC’s (Fundação para a Ciência e a Tecnologia, I.P.) financial support through national funding and by the European Regional Development Fund through the Operational Programme on “Competitiveness and Internationalization - COMPETE 2020” under the PT2020 Partnership Agreement.

References

M. I. Falcão and F. Miranda, “Quaternions: A Mathematica Package for Quaternionic Analysis,” in Computational Science and Its Applications (ICCSA 2011), Lecture Notes in Computer Science, 6784 (B. Murgante, O. Gervasi, A. Iglesias, D. Taniar and B. O. Apduhan, eds.), Berlin, Heidelberg: Springer, 2011 pp. 200–214. doi:10.1007/978-3-642-21931-3_17.

F. Miranda and M. I. Falcão. “QuaternionAnalysis Mathematica Package.” w3.math.uminho.pt/QuaternionAnalysis.

M. I. Falcão, F. Miranda, R. Severino and M. J. Soares, “Evaluation Schemes in the Ring of Quaternionic Polynomials,” BIT Numerical Mathematics, 58(1), pp. 51–72. doi:10.1007/s10543-017-0667-8.

M. I. Falcão, F. Miranda, R. Severino and M. J. Soares, “Mathematica Tools for Quaternionic Polynomials,” in Computational Science and Its Applications (ICCSA 2017), Lecture Notes in Computer Science, 10405, (O. Gervasi, B. Murgante, S. Misra, G. Borruso, C. M. Torre, A. M. A. C. Rocha, D. Taniar, B. O. Apduhan, E. Stankova and A. Cuzzocrea, eds.), Berlin, Heidelberg: Springer, 2017 pp. 394–408. doi:10.1007/978-3-319-62395-5_27.

M. I. Falcão, F. Miranda, R. Severino and M. J. Soares, “Weierstrass Method for Quaternionic Polynomial Root-Finding,” Mathematical Methods in the Applied Sciences, 2017 pp. 1–15. doi:10.1002/mma.4623.

N. Jacobson, The Theory of Rings (Mathematical Surveys and Monographs), New York: American Mathematical Society, 1943.

A. Damiano, G. Gentili and D. Struppa, “Computations in the Ring of Quaternionic Polynomials,” Journal of Symbolic Computation, 45(1), 2010 pp. 38–45. doi:10.1016/j.jsc.2009.06.003.

F. Zhang, “Quaternions and Matrices of Quaternions,” Linear Algebra and Its Applications, 251, 1997 pp. 21–57. doi:10.1016/0024-3795(95)00543-9.

B. Beck, “Sur les équations polynomiales dans les quaternions,” L’ Enseignement Mathématique, 25, 1979 pp. 193–201.

A. Pogorui and M. Shapiro, “On the Structure of the Set of Zeros of Quaternionic Polynomials,” Complex Variables. Theory and Application, 49(6), 2004 pp. 379–389. doi:10.1080/0278107042000220276.

B. Gordon and T. S. Motzkin, “On the Zeros of Polynomials over Division Rings,” Transactions of the American Mathematical Society, 116, 1965 pp. 218–226. doi:10.1090/S0002-9947-1965-0195853-2.

T.-Y. Lam, A First Course in Noncommutative Rings, New York: Springer-Verlag, 1991.

I. Niven, “Equations in Quaternions,” The American Mathematical Monthly, 48(10), 1941 pp. 654–661. www.jstor.org/stable/2303304.

R. Serôdio and L.-S. Siu, “Zeros of Quaternion Polynomials”. Applied Mathematics Letters, 14(2), 2001 pp. 237–239. doi:10.1016/S0893-9659(00)00142-7.

R. Pereira, Quaternionic Polynomials and Behavioral Systems, Ph.D. thesis, Departamento de Matemática, Universidade de Aveiro, Portugal, 2006.

G. Gentili and D. C. Struppa, “On the Multiplicity of Zeroes of Polynomials with Quaternionic Coefficients,” Milan Journal of Mathematics, 76(1), 2008 pp. 15–25. doi:10.1007/s00032-008-0093-0.

M. I. Falcão, F. Miranda, R. Severino and M. J. Soares, “Quaternionic Polynomials with Multiple Zeros: A Numerical Point of View,” in 11th International Conference on Mathematical Problems in Engineering, Aerospace and Sciences (ICNPAA 2016), La Rochelle, France, AIP Conference Proceedings, 1798(1), 2017 p. 020099. doi:10.1063/1.4972691.

H. R. Malonek, “Quaternions in Applied Sciences. A Historical Perspective of a Mathematical Concept,” in 17th International Conference on the Applications of Computer Science and Mathematics in Architecture and Civil Engineering (IKM 2003) (K. Gürlebeck and C. Könke, eds.), Weimar, Germany, 2003.

The package QuaternionAnalysis.

Available at: w3.math.uminho.pt/QuaternionAnalysis

The file QPolynomial.m.

Available at: www.mathematica-journal.com/data/uploads/2018/05/QPolynomial.m