Question

# 问题

Questions in category: 开发计划 (DevPlan).

## [DevPlan] 给定数列的递推公式, 打印数列的前若干项.

Posted by haifeng on 2023-02-04 10:15:46 last update 2023-02-05 20:57:46 | Answers (0) | 收藏

>> x=2
--------------------
>> y=(x^2+2)/(x+4)
----------------------------
type: string
name: y
value: (x^2+2)/(x+4)
value_computed: 1
--------------------
>> x=y
----------------------------
type: string
name: x
value: (y)
value_computed: 1
--------------------
>> y=(x^2+2)/(x+4)
----------------------------
type: string
name: y
value: (x^2+2)/(x+4)
value_computed: 0.6
--------------------
>> y
in> (0.6)

out> 0.6

------------------------

$a_1=2,\quad a_2=1,\quad a_3=\frac{3}{5},\quad a_4=\frac{59}{115}$

>> printRecursiveSeries((n^2+2)/(n+4),n,2,10,\n)
in> printRecursiveSeries((n^2+2)/(n+4),n,2,10,\n)
1
0.6
0.51304348
0.50148278
0.50016519
0.50001836
0.50000204
0.50000023
0.50000003
0.50000000

------------------------

>> :mode=fraction
Switch into fraction calculating mode.
e.g., 1/2+1/3 will return 5/6

>> printRecursiveSeries((n^2+2)/(n+4),n,2,10,\n)
in> printRecursiveSeries((n^2+2)/(n+4),n,2,10,\n)
1
3|5
59|115
9977|19895
891162579|1781736515
7143340759978621691|14286156943343253085
153071959210947077593344209777606577977|306142669345391339033273867001310578545
210877692684521073632686796614427621177608849307584544993392729791345410046579|421755194170454656838715623548179223078639124055129803382668276046037982971565
400224288891463132245588513262675832580155294150347514542265716671466587416216808432328845025373819376120940561495311696075422019773351889910473522146701691|800448537463409289970468912605629751484284184673346880817551678682345444242416699895610264410961644842938069217110623535798264962551964970919962105876723035
480538401224433076914322107044892889273619273662533194150556851587360737976789610786946600683365362655087382494630247466268531496887249965680481862880481156186674147551392766374398353649598099830434467531101824929956726062281597466600813520823786097638583908474247882847900409669162905195171606419138016780493977|961076797069916150637035067794869620082760044754356287427841416504669963950089965195105960796484833842639813529070119301247099221843344998442808673021667792117820296445588510208551637135412798708771976135899044690996631347449387596569472159842757832149769436510643469544737024421672111730371918134099365723865695

------------------------

$\begin{cases} a_n&=2a_{n-1}+2a_{n-2},\\ a_1&=3,\\ a_2&=8. \end{cases}$