powered by
Create a geometric sequence.
GeometricSequence(length, initial.value = 1, discount.factor = .5)
A numeric vector containing the desired sequence.
A positive integer giving the length of the desired sequence.
The first term in the sequence. Cannot be zero.
The ratio between a sequence term and the preceding term. Cannot be zero.
Steven L. Scott steve.the.bayesian@gmail.com
GeometricSequence(4, .8, .6) # [1] 0.8000 0.4800 0.2880 0.1728 GeometricSequence(5, 2, 3) # [1] 2 6 18 54 162 if (FALSE) { GeometricSequence(0, -1, -2) # Error: length > 0 is not TRUE }
Run the code above in your browser using DataLab