由项求数列通项公式(Formula of a sequence from its terms,find_sequence_function)
由开头若干项求数列的公式;仅当它还能预测另外两项时才给出。
怎么写
find_sequence_function(terms, variable)
给出每一项的公式 a(n),以及跟在它后面的项;若少一项,则以规则作为提示。
- terms
- 开头的若干项,整数或分数,第一项为 a(1)。接受一个列表。
- variable
- 公式的指标,如 n 这样的名字。接受一个变量或变量列表。
示例
find_sequence_function([1, 4, 9, 16, 25], n)在求解器中,
在求解器中打开find_sequence_function([1, 4, 9, 16, 25], n)的结果是n^2。find_sequence_function([1, 1, 2, 3, 5, 8, 13, 21], n)在求解器中,
在求解器中打开find_sequence_function([1, 1, 2, 3, 5, 8, 13, 21], n)的结果是fibonacci(n)。find_sequence_function([1, 2, 6, 24, 120], n)在求解器中,
在求解器中打开find_sequence_function([1, 2, 6, 24, 120], n)的结果是n!。find_sequence_function([2, 3, 5, 5, 8, 7], n)在求解器中,
在求解器中打开find_sequence_function([2, 3, 5, 5, 8, 7], n)的结果是piecewise((3n + 1)/2 if n % 2 = 1, n + 1 otherwise)。find_sequence_function([3, 8, 17, 32, 57, 100, 177], n)在求解器中,
在求解器中打开find_sequence_function([3, 8, 17, 32, 57, 100, 177], n)的结果是n^2 + 2^n。
相关函数
- find_linear_recurrence
一个项列表所满足的递推关系;仅当它在另外两项上也成立时才给出。
- next_terms
列表之后的项:仅当某条规则能解释它并预测出另外两项时才给出。
- numeric_product
在某个范围内对表达式求乘积,以小数表示。
- differences
列表中相邻元素之差。
- numeric_sum
在某个范围内对表达式求和,以小数表示。
- sum_convergence
检验表达式关于某个变量的和是否收敛。