Functions of Rational Numbers
# S4 method for rationalS4 Math(x) # S3 method for rationalS3 Math(x, ...) # S3 method for rationalR6 Math(x, ...) # S4 method for rationalS4 Math2(x) # S4 method for rationalS4 abs(x) # S3 method for rationalS3 abs(x) # S3 method for rationalR6 abs(x) # S4 method for rationalS4 log(x, base = exp(1)) # S3 method for rationalS3 log(x, base = exp(1)) # S3 method for rationalR6 log(x, base = exp(1)) # S4 method for rationalS4 log10(x) log10.rationalS3(x) log10.rationalR6(x) # S4 method for rationalS4 logb(x, base = exp(1)) logb.rationalS3(x, base = exp(1)) logb.rationalR6(x, base = exp(1)) # S4 method for rationalS4 log2(x) log2.rationalS3(x) log2.rationalR6(x) # S4 method for rationalS4 gamma(x) # S3 method for rationalS3 gamma(x) # S3 method for rationalR6 gamma(x) # S4 method for rationalS4 max(x, ..., na.rm = FALSE) # S3 method for rationalS3 max(..., na.rm = FALSE) # S3 method for rationalR6 max(..., na.rm = FALSE) # S4 method for rationalS4 min(x, ..., na.rm = FALSE) # S3 method for rationalS3 min(..., na.rm = FALSE) # S3 method for rationalR6 min(..., na.rm = FALSE) # S4 method for rationalS4 range(x, ..., na.rm = FALSE) # S3 method for rationalS3 range(..., na.rm = FALSE) # S3 method for rationalR6 range(..., na.rm = FALSE) # S4 method for rationalS4 prod(x, ..., na.rm = FALSE) # S3 method for rationalS3 prod(..., na.rm = FALSE) # S3 method for rationalR6 prod(..., na.rm = FALSE) # S4 method for rationalS4 sum(x, ..., na.rm = FALSE) # S3 method for rationalS3 sum(..., na.rm = FALSE) # S3 method for rationalR6 sum(..., na.rm = FALSE)
x | rational numbers |
---|---|
... | rational numbers |
base | the logarithm base in the |
na.rm | will NAs be removed from a collection before the computation is performed |
#> [1] 2#> [1] -1#> [1] 1.395612#> [1] 1.395612#> [1] 2x <- abs(rational(-2L, 3L, "S4")) stopifnot("rationalS4" %in% class(x)) x <- abs(rational(-2L, 3L, "S3")) stopifnot("rationalS3" %in% class(x)) x <- abs(rational(-2L, 3L, "R6")) stopifnot("rationalR6" %in% class(x)) log(rational(2L, 5L, "S4"))#> [1] -0.9162907#> [1] -0.9162907#> [1] -0.9162907#> [1] -0.39794#> [1] -0.39794#> [1] -0.39794#> [1] -0.5693234#> [1] -0.5693234#> [1] -0.5693234#> [1] -1.321928#> [1] -1.321928#> [1] -1.321928#> [1] 2.21816#> [1] 2.21816#> [1] 2.21816#> (3 / 1) = 3#> [1] "(3 / 1) = 3"#> [1] "(3 / 1) = 3"#> (2 / 5) = 0.4#> [1] "(2 / 5) = 0.4"#> [1] "(2 / 5) = 0.4"#> [[1]] #> (2 / 5) = 0.4 #> [[2]] #> (3 / 1) = 3#> [[1]] #> [1] "(2 / 5) = 0.4" #> #> [[2]] #> [1] "(3 / 1) = 3" #>#> [[1]] #> [1] "(2 / 5) = 0.4" #> #> [[2]] #> [1] "(3 / 1) = 3" #>#> (6 / 5) = 1.2#> [1] "(6 / 5) = 1.2"#> [1] "(6 / 5) = 1.2"#> (17 / 5) = 3.4#> [1] "(17 / 5) = 3.4"#> [1] "(17 / 5) = 3.4"