3. If any abs(c2) < complex.eps, make sure the numbers are not
duplicate reals via (d2 = abs(outer(x, x, "-"))) > complex.eps
Value
a complex vector with one representative of each complex pair found
Author(s)
Spencer Graves and Ravi Varadhan
See Also
plotArmaTrueacf
Examples
# none
findConjugates(NULL)
findConjugates(numeric(0))
findConjugates(0:4)
findConjugates(rep(0:1,each=3))
# some
findConjugates(c(1+1i, 0, 1-1i, 2-2i, 3, 2+2i, NA))
# Testing with polyroot and solve(polynomial(...))
set.seed(1234)
if(require(polynom)){
p <- polynomial(sample(1:10, size=45, rep=TRUE)) # degree 44
z <- solve(p)
findConjugates(z, complex.eps=.Machine$double.eps)
# this identifies all 21 conjugate pairs, R 2.6.0 for Windows
z1 <- polyroot(p)
findConjugates(z1, complex.eps=.Machine$double.eps)
# this only identifies only 3 conjugate pairs, R 2.6.0 for Windows
}
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FinTS)
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FinTS/findConjugates.Rd_%03d_medium.png", width=480, height=480)
> ### Name: findConjugates
> ### Title: Find complex conjugate pairs
> ### Aliases: findConjugates
> ### Keywords: arith
>
> ### ** Examples
>
> # none
> findConjugates(NULL)
complex(0)
> findConjugates(numeric(0))
complex(0)
> findConjugates(0:4)
complex(0)
> findConjugates(rep(0:1,each=3))
complex(0)
>
> # some
> findConjugates(c(1+1i, 0, 1-1i, 2-2i, 3, 2+2i, NA))
[1] 1-1i 2+2i
>
> # Testing with polyroot and solve(polynomial(...))
> set.seed(1234)
> if(require(polynom)){
+ p <- polynomial(sample(1:10, size=45, rep=TRUE)) # degree 44
+ z <- solve(p)
+ findConjugates(z, complex.eps=.Machine$double.eps)
+ # this identifies all 21 conjugate pairs, R 2.6.0 for Windows
+
+ z1 <- polyroot(p)
+ findConjugates(z1, complex.eps=.Machine$double.eps)
+ # this only identifies only 3 conjugate pairs, R 2.6.0 for Windows
+ }
Loading required package: polynom
[1] -0.6273514-0.5454306i 0.2827538+0.8198364i -0.8116597-0.2088207i
>
>
>
>
>
> dev.off()
null device
1
>