Formula: repeat polynomial division, gcd(a, b) = gcd(b, a mod b), until the remainder vanishes; the last non-zero remainder, made monic, is the greatest common divisor. Algorithm E of Knuth, TAOCP Vol. 2, sec. 4.6.1, run over the reals with a numerical tolerance in place of exact zero testing.
References
Knuth (1997), The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed., sec. 4.6.1, Addison-Wesley.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
EuclP(V, V)
#> $estimate
#> [1] 7
#>
#> $gcd
#> [1] 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.000
#>
#> $degree
#> [1] 7
#>
#> $steps
#> [1] 1
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Polynomial GCD via Euclid"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
