Formula of a sequence from its terms (find_sequence_function)
The formula of a sequence from its first terms, given only when it also predicts two more.
How to write it
find_sequence_function(terms, variable)
A formula a(n) that gives every term, with the terms that follow it; one term short, the rule as a hint.
- terms
- The first terms, whole numbers or fractions, the first being a(1). Takes a list.
- variable
- The index of the formula, a name such as n. Takes a variable, or a list of variables.
Examples
find_sequence_function([1, 4, 9, 16, 25], n)In the solver,
Open in the solverfind_sequence_function([1, 4, 9, 16, 25], n)givesn^2.find_sequence_function([1, 1, 2, 3, 5, 8, 13, 21], n)In the solver,
Open in the solverfind_sequence_function([1, 1, 2, 3, 5, 8, 13, 21], n)givesfibonacci(n).find_sequence_function([1, 2, 6, 24, 120], n)In the solver,
Open in the solverfind_sequence_function([1, 2, 6, 24, 120], n)givesn!.find_sequence_function([2, 3, 5, 5, 8, 7], n)In the solver,
Open in the solverfind_sequence_function([2, 3, 5, 5, 8, 7], n)givespiecewise((3n + 1)/2 if n % 2 = 1, n + 1 otherwise).find_sequence_function([3, 8, 17, 32, 57, 100, 177], n)In the solver,
Open in the solverfind_sequence_function([3, 8, 17, 32, 57, 100, 177], n)givesn^2 + 2^n.
Related functions
- find_linear_recurrence
The recurrence a list of terms obeys, given only when it also holds on two more.
- next_terms
The terms that follow a list, given only when a rule explains it and predicts two more.
- numeric_product
Multiply an expression over a range, as a decimal.
- differences
The differences between neighbouring elements of a list.
- numeric_sum
Add up an expression over a range, as a decimal.
- sum_convergence
Test whether the sum of an expression over a variable converges.