当前位置:网站首页>[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
2022-07-03 17:06:00 【Programmer community】
List of articles
- One 、 Fibonacci sequence solution
- Two 、 Complete process of solving recursive equations without multiple roots
One 、 Fibonacci sequence solution
1 . Fibonacci sequence example :
( 1 ) Fibonacci sequence :
1
,
1
,
2
,
3
,
5
,
8
,
13
,
⋯
1 , 1 , 2 , 3 , 5 , 8 , 13 , \cdots
1,1,2,3,5,8,13,⋯
( 2 ) Recurrence equation :
F
(
n
)
=
F
(
n
−
1
)
+
F
(
n
−
2
)
F(n) = F(n-1) + F(n-2)
F(n)=F(n−1)+F(n−2)
describe : The first
n
n
n Item equal to
n
−
1
n-1
n−1 term and The first
n
−
2
n-2
n−2 Sum of items ;
Such as : The first
4
4
4 Item value
F
(
4
)
=
5
F(4) = 5
F(4)=5 , Is equal to
The first
4
−
1
=
3
4-1=3
4−1=3 Item value
F
(
4
−
1
)
=
F
(
3
)
=
3
F(4-1)=F(3) = 3
F(4−1)=F(3)=3
add The first
4
−
2
=
2
4-2=2
4−2=2 Item value
F
(
4
−
2
)
=
F
(
2
)
=
2
F(4-2) = F(2) =2
F(4−2)=F(2)=2 ;
( 3 ) initial value :
F
(
0
)
=
1
,
F
(
1
)
=
1
F(0) = 1 , F(1) = 1
F(0)=1,F(1)=1
according to
F
(
0
)
=
1
,
F
(
1
)
=
1
F(0) = 1, F(1) = 1
F(0)=1,F(1)=1 You can calculate
F
(
2
)
F(2)
F(2) , according to
F
(
1
)
,
F
(
2
)
F(1),F(2)
F(1),F(2) You can calculate
F
(
3
)
F(3)
F(3) , according to
F
(
2
)
F
(
3
)
F(2)F(3)
F(2)F(3) Sure Calculation
F
(
4
)
F(4)
F(4) ,
⋯
\cdots
⋯ , according to
F
(
n
−
2
)
,
F
(
n
−
1
)
F(n-2) , F(n-1)
F(n−2),F(n−1) You can calculate
F
(
n
)
F(n)
F(n) ;
2 . Write the characteristic equation of Fibonacci sequence and solve the characteristic root :
Recurrence equation :
F
(
n
)
=
F
(
n
−
1
)
+
F
(
n
−
2
)
F(n) = F(n-1) + F(n-2)
F(n)=F(n−1)+F(n−2)
( 1 ) The standard form of recurrence equation :
F
(
n
)
−
F
(
n
−
1
)
−
F
(
n
−
2
)
=
0
F(n) - F(n-1) - F(n-2) = 0
F(n)−F(n−1)−F(n−2)=0
( 2 ) Recursive equation writing :
① First determine the number of terms of the characteristic equation : The same number of terms as the recursive equation ,
3
3
3 term ;
② In determining the characteristic equation
x
x
x Power of power : from
3
−
1
=
2
3-1=2
3−1=2 To
0
0
0 ;
③ Write a recurrence equation without coefficients :
x
2
+
x
1
+
x
0
=
0
x^2 + x^1 + x^0 = 0
x2+x1+x0=0
④ Filling factor : Then the characteristic equation without coefficients
x
2
+
x
1
+
x
0
=
0
x^2 + x^1 + x^0 = 0
x2+x1+x0=0 And
F
(
n
)
−
F
(
n
−
1
)
−
F
(
n
−
2
)
=
0
F(n) - F(n-1) - F(n-2) = 0
F(n)−F(n−1)−F(n−2)=0 The coefficients of corresponding bits are filled into the characteristic equation :
x
2
x^2
x2 The coefficient before Corresponding
F
(
n
)
F(n)
F(n) Coefficient before item
1
1
1 ;
x
1
x^1
x1 The coefficient before Corresponding
F
(
n
−
1
)
F(n-1)
F(n−1) Coefficient before item
−
1
-1
−1 ;
x
0
x^0
x0 The coefficient before Corresponding
F
(
n
−
2
)
F(n-2)
F(n−2) Coefficient before item
−
1
-1
−1 ;
Then the final The characteristic equation is
1
x
2
+
(
−
1
)
x
1
+
(
−
1
)
x
0
=
0
1 x^2 + (-1)x^1 + (-1)x^0 = 0
1x2+(−1)x1+(−1)x0=0 , It is reduced to :
x
2
−
x
−
1
=
0
x^2 - x - 1 = 0
x2−x−1=0
The characteristic root of the characteristic equation is : The solution of the above equation is the characteristic root , Generally, it is a quadratic equation with one variable ;
x
=
1
±
5
2
x = \cfrac{1 \pm \sqrt{5}}{2}
x=21±5
Reference resources : Univariate quadratic equation form
a
x
2
+
b
x
+
c
=
0
ax^2 + bx + c = 0
ax2+bx+c=0
The solution is :x
=
−
b
±
b
2
−
4
a
c
2
a
x = \cfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
x=2a−b±b2−4ac
3 . Write the general solution of Fibonacci sequence :
The characteristic root of Fibonacci series recurrence equation is :
1
±
5
2
\cfrac{1 \pm \sqrt{5}}{2}
21±5 ;
q
1
=
1
+
5
2
q_1 = \cfrac{1 + \sqrt{5}}{2}
q1=21+5 ,
q
2
=
1
−
5
2
q_2 =\cfrac{1 - \sqrt{5}}{2}
q2=21−5
The general solution is in the form of
F
(
n
)
=
c
1
q
1
n
+
c
2
q
2
n
+
⋯
+
c
k
q
k
n
F(n) = c_1q_1^n + c_2q_2^n + \cdots + c_kq_k^n
F(n)=c1q1n+c2q2n+⋯+ckqkn
Set feature root
q
1
,
q
2
q_1 , q_2
q1,q2 After substituting the above general solution form, it becomes :
F
(
n
)
=
c
1
(
1
+
5
2
)
n
+
c
2
(
1
−
5
2
)
n
F(n) = c_1 ( \cfrac{1 + \sqrt{5}}{2} ) ^n + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) ^n
F(n)=c1(21+5)n+c2(21−5)n
4 . Substitute the initial value of the recurrence equation into general solution , Solve the constants in the general solution :
Fibonacci sequence Initial value of recurrence equation :
F
(
0
)
=
1
,
F
(
1
)
=
1
F(0) = 1 , F(1) = 1
F(0)=1,F(1)=1
Substitute the above initial value
F
(
0
)
=
1
,
F
(
1
)
=
1
F(0) = 1 , F(1) = 1
F(0)=1,F(1)=1 To General solution of recurrence equation
F
(
n
)
=
c
1
(
1
+
5
2
)
n
+
c
2
(
1
−
5
2
)
n
F(n) = c_1 ( \cfrac{1 + \sqrt{5}}{2} ) ^n + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) ^n
F(n)=c1(21+5)n+c2(21−5)n in , The following equations are obtained :
{
c
1
(
1
+
5
2
)
0
+
c
2
(
1
−
5
2
)
0
=
F
(
0
)
=
1
c
1
(
1
+
5
2
)
1
+
c
2
(
1
−
5
2
)
1
=
F
(
1
)
=
1
\begin{cases} c_1 ( \cfrac{1 + \sqrt{5}}{2} ) ^0 + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) ^0 = F(0) = 1 \\\\ c_1 ( \cfrac{1 + \sqrt{5}}{2} ) ^1 + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) ^1 = F(1) = 1 \end{cases}
⎩⎪⎪⎪⎪⎨⎪⎪⎪⎪⎧c1(21+5)0+c2(21−5)0=F(0)=1c1(21+5)1+c2(21−5)1=F(1)=1
After simplification, we get :
{
c
1
+
c
2
=
1
c
1
(
1
+
5
2
)
+
c
2
(
1
−
5
2
)
=
1
\begin{cases} c_1 + c_2 = 1 \\\\ c_1 ( \cfrac{1 + \sqrt{5}}{2} ) + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) = 1 \end{cases}
⎩⎪⎪⎨⎪⎪⎧c1+c2=1c1(21+5)+c2(21−5)=1
Solve the above equations :
c
1
=
1
5
1
+
5
2
,
c
2
=
−
1
5
1
−
5
2
c_1 =\cfrac{1}{\sqrt{5}} \cfrac{1 + \sqrt{5}}{2}, \ \ c_2 =-\cfrac{1}{\sqrt{5}} \cfrac{1 - \sqrt{5}}{2}
c1=5121+5, c2=−5121−5
Will constant
c
1
=
1
5
1
+
5
2
,
c
2
=
−
1
5
1
−
5
2
c_1 =\cfrac{1}{\sqrt{5}} \cfrac{1 + \sqrt{5}}{2}, \ \ c_2 =-\cfrac{1}{\sqrt{5}} \cfrac{1 - \sqrt{5}}{2}
c1=5121+5, c2=−5121−5 Substitute into the general solution
F
(
n
)
=
c
1
(
1
+
5
2
)
n
+
c
2
(
1
−
5
2
)
n
F(n) = c_1 ( \cfrac{1 + \sqrt{5}}{2} ) ^n + c_2 ( \cfrac{1 - \sqrt{5}}{2} ) ^n
F(n)=c1(21+5)n+c2(21−5)n in , You can get a general solution :
F
(
n
)
=
1
5
1
+
5
2
(
1
+
5
2
)
n
−
1
5
1
−
5
2
(
1
−
5
2
)
n
F(n) = \cfrac{1}{\sqrt{5}} \cfrac{1 + \sqrt{5}}{2} ( \cfrac{1 + \sqrt{5}}{2} ) ^n - \cfrac{1}{\sqrt{5}} \cfrac{1 - \sqrt{5}}{2} ( \cfrac{1 - \sqrt{5}}{2} ) ^n
F(n)=5121+5(21+5)n−5121−5(21−5)n
It is reduced to :
F
(
n
)
=
1
5
(
1
+
5
2
)
n
+
1
−
1
5
(
1
−
5
2
)
n
+
1
F(n) = \cfrac{1}{\sqrt{5}}( \cfrac{1 + \sqrt{5}}{2} ) ^{n+1} - \cfrac{1}{\sqrt{5}} ( \cfrac{1 - \sqrt{5}}{2} ) ^{n+1}
F(n)=51(21+5)n+1−51(21−5)n+1
Two 、 Complete process of solving recursive equations without multiple roots
Complete process of solving recursive equations without multiple roots :
- 1 . Write the characteristic equation :
- ( 1 ) The standard form of recurrence equation : Write the recurrence equation Standard form , All items are to the left of the equal sign , On the right is
0
0
0 ;
- ( 2 ) Number of terms of characteristic equation : determine Number of terms of characteristic equation , And The recurrence equation has the same number of terms ;
- ( 3 ) The characteristic equation is sub idempotent : The highest power is Number of terms of characteristic equation
−
1
-1
0
0
0 ;
−1 , Lowest power
- ( 4 ) Write There is no coefficient The characteristic equation of ;
- ( 5 ) The coefficients of the recursive equation will be deduced bit by bit Copy Into the characteristic equation ;
- ( 1 ) The standard form of recurrence equation : Write the recurrence equation Standard form , All items are to the left of the equal sign , On the right is
- 2 . Solution characteristic root : take The eigenvalue of the characteristic equation is solved ,
x
=
−
b
±
b
2
−
4
a
c
2
a
x = \cfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
x=2a−b±b2−4ac
- 3 . Construct the general solution of recurrence equation : structure
c
1
q
1
n
+
c
2
q
2
n
+
⋯
+
c
k
q
k
n
c_1q_1^n + c_2q_2^n + \cdots + c_kq_k^n
c1q1n+c2q2n+⋯+ckqkn Linear combination of forms , The linear combination is the solution of the recursive equation ;
- 4 . Find the constant in the general solution : Substitute the initial value of the recursive equation into the general solution , obtain
k
k
k individual
k
k
k Finite element equations , By solving the equations , Get the constant in the general solution ;
- ( 1 ) The constant is substituted into the general solution : Get the final solution of the recursive equation ;
Recurrence equation -> Characteristic equation -> Characteristic root -> general solution -> Substitute the initial value to find the general solution constant
边栏推荐
- 在iptables防火墙下开启vsftpd的端口
- What is the material of sa302grc? American standard container plate sa302grc chemical composition
- IL Runtime
- What is your income level in the country?
- 浅谈拉格朗日插值及其应用
- Visual studio "usually, each socket address (Protocol / network address / port) can only be used once“
- RF Analyze Demo搭建 Step by Step
- What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
- Free data | new library online | cnopendata complete data of China's insurance intermediary outlets
- Kotlin learning quick start (7) -- wonderful use of expansion
猜你喜欢

One brush 149 force deduction hot question-10 regular expression matching (H)

线程池:业务代码最常用也最容易犯错的组件

Daily code 300 lines learning notes day 10

Static program analysis (I) -- Outline mind map and content introduction

One brush 145 force deduction hot question-2 sum of two numbers (m)

Shentong express expects an annual loss of nearly 1billion

Redis:关于列表List类型数据的操作命令

Kotlin学习快速入门(7)——扩展的妙用

Mysql database -dql

【Try to Hack】主动侦查隐藏技术
随机推荐
Bcvp developer community 2022 exclusive peripheral first bullet
CC2530 common registers for ADC single channel conversion
C language modifies files by line
function overloading
基于主机的入侵系统IDS
One brush 147-force deduction hot question-4 find the median of two positive arrays (H)
比亚迪、长城混动市场再“聚首”
What is the material of sa302grc? American standard container plate sa302grc chemical composition
New features of C 10
Web crawler knowledge day03
What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
CC2530 common registers for port initialization
CC2530 common registers
What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR
mysql用户管理
聊聊接口优化的几个方法
One brush 148 force deduction hot question-5 longest palindrome substring (m)
Redis:关于列表List类型数据的操作命令
Assembly instance analysis -- screen display in real mode
What material is 12cr1movr? Chemical property analysis of pressure vessel steel plate 12cr1movr