Learn R Programming

contFracR (version 1.2.1)

cfrac2simple: Function to Convert Continued Fraction to Simple Fraction.

Description

Given a vector of denominators and optionally numerators for a continued fraction, return the "simple" continued fraction where all numerators are 1. In addition, return the exact "simple" fraction x/y where both are integers.

Usage

cfrac2simple(denom, num =1, ...)

Value

A list containing: intfrac ,the integer fraction as a bigq value. denom, the denominator sequence for the continued fraction with all numerators equal to one.

Arguments

denom

A vector of values representing the standard [b0; a1,a2,a3...] continued fraction denominators, starting with the integer part.

num

A vector of values representing the numerators in a continued fraction. The default is nums = 1 as is the case for cfrac2num .

...

Reserved for future use

Author

Carl Witthoft, carl@witthoft.com

See Also

cfrac2num, num2cfrac

Examples

Run this code
foon <- c(1,3,5,7,9)
food <- c(1,2,4,6,8,10)
foosimple <- cfrac2simple(denom =food, num=foon)
# compare with these two:
cfrac2num(den=food, num= foon)
cfrac2num(den=foosimple$denom)

Run the code above in your browser using DataLab