fractions {exams.forge}R Documentation

Fractions

Description

Finds rational approximations to the components of a real numeric object, using a standard continued fraction method. Calls MASS::fractions() (Please refer to that for further details).

Usage

fractions(x, cycles = 10, max.denominator = 2000, ...)

approx_rational(x, cycles = 10, max.denominator = 2000, ...)

Arguments

x

any object of the numeric mode (missing values are allowed)

cycles

the maximum number of steps to be used in the continued fraction approximation process

max.denominator

an early termination criterion. If any partial denominator exceeds max.denominator, the continued fraction stops at that point

...

further arguments

Value

An object of the class fractions. A structure with a .Data component, the same as the numeric x input, but with the rational approximations held as the character vector attribute fracs. Arithmetic operations on fractions objects are possible.

Examples

X <- matrix(runif(25), 5, 5)
fractions(X) #;)
fractions(solve(X, X/5))
fractions(solve(X, X/5)) + 1

[Package exams.forge version 1.0.10 Index]