| rat | R Documentation |
Generate continuous fractions for numeric values.
rat(x, tol = 1e-06)
rats(x, tol = 1e-06)
x |
a numeric scalar or vector. |
tol |
tolerance; default |
rat generates continuous fractions, while rats prints the
the corresponding rational representation and returns the numeric values.
rat returns a character vector of string representations of
continuous fractions in the format [b0; b1, ..., b_{n-1}].
rats prints the rational number and returns a numeric vector.
Essentially, these functions apply contfrac.
numbers::contfrac
rat(pi)
rats(pi)
rat(sqrt(c(2, 3, 5)), tol = 1e-15)
rats(sqrt(c(2, 3, 5)), tol = 1e-15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.