divisor {StratigrapheR}R Documentation

Greatest Common Rational Divisor

Description

Compute the Greatest Common Rational Divisor or test whether a value is a common rational divisor of a suite of number

Usage

divisor(x, tolerance = 8, relative = T, tries = 4, speak = T)

is.divisor(x, y, tolerance = 8, relative = T, use.names = T)

Arguments

x

a numeric or integer vector

tolerance

the order of tolerance for errors, i.e. the number of decimals considered as being meaningful

relative

whether to apply the tolerance to the x values divided by the smallest x value (TRUE, is the default), or to the x values themselves

tries

the amount of iterations: each iteration tests 10^n+1 more possibilities than the previous one. This is to optimise computation while allowing all possibilities to be explored. Each try takes exponentialy more time than the previous one

speak

whether to print a sentence at each try

y

a numeric or integer vector of vales to be tested as divisors of x

use.names

whether to use y values as names for the output

Examples

divisor(x = c(0.03,0.75,0.3,2,100, 0.03, 100, 0), speak = FALSE)

divisor(x = c(0.02,0.75,0.3,2,100.000002, 0.03, 100, 0), speak = FALSE)

divisor(x = c(0.02,0.75,0.3,2,100.000002, 0.03, 100, 0) * 10^-10,
        speak = FALSE)


a <- c(0.02,0.75,0.3,2,100.000000002, 0.03, 100, 0)

divisor(x = a)

is.divisor(x = a, y = c(1, 0.01, 2*10^-9))

divisor(x = a, tolerance = 7, speak = FALSE)

divisor(x = a, relative = FALSE, speak = FALSE)


[Package StratigrapheR version 1.3.1 Index]