seq_geometric: Generate Geometric Sequence

View source: R/seq_geometric.R

seq_geometricR Documentation

Generate Geometric Sequence

Description

Function to generate a sequence of equal ratios, also known as a geometric sequence. Geometric sequence, also known as a Geometric progression, is a sequence of non-zero numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio. This function can only generate finite sequences of numbers, not infinite sequences.

Usage

seq_geometric(from, to, by.ratio, length.out = NULL)

Arguments

from

Number. First term. Scale factor, equal to the sequence's start value.

to

Number. If the value closest to the last term in the finite series you want is not 'to' in the identity series, the value closest to 'to' and closest to 'from' in the identity series will be the last term. If 'to' is contained on an geometric sequence, it is the last term.

by.ratio

Number. Common ratio.

length.out

Number. Desired length of the sequence. A non-negative number. It will be rounded up if fractional.

Details

Numerical inputs should all be finite (that is, not infinite, NaN or NA).

Value

numeric arguments return a vector of type integer or double: programmers should not rely on which.

See Also

seq

Examples

seq_geometric(1, 10, 2)
seq_geometric(1, 10, 2, length.out = 3)
seq_geometric(1, 0.001, 0.1)
seq_geometric(1, 0.001, 0.1, length.out = 3)

indenkun/infun documentation built on April 17, 2025, 2:52 p.m.