RT, mainly to summarize the matrix method.
First, the recursive type of matrix-based rapid power oPtimization is f [N] = 5f [n-3] + 6f [N-2] + 2f [n-1] + N ^ 2 + N + 8 and so on.
That is to say, recursion is linear recursion, and the coefficient before f [n-I] is a constant. It can contain a polynomial related to N or a constant, the following describes how to write a matrix:
First, consider the simplest constant. In fact, we can ignore the constant, because at most we can add a row and a column to the matrix without constants.
Taking f [N] = 2f [n-1] + 6f [N-2] + 5f [n-3] + N ^ 2 + N as an Example
First, write the iterative matrix. Generally, you can write a row. There are several items on the right.
{F [n-1], F [N-2], F [n-3], n ^ 2, n}
If so, the Number Matrix must be 5*5 (because the 1*5 matrix multiplied by 5 * x matrix is equal to 1*5 matrix, then x = 5)
But I can't find it. Why? Because n ^ 2 and N cannot be obtained through the four arithmetic operations of a simple number (n + 1) ^ 2 and n + 1, but we can write
{F [n-1], F [N-2], F [n-3], n ^ 2, N, 2n}
*
2 1 0 0 0 0 0 0
6 0 1 0 0 0 0 0
5 0 0 0 0 0 0 0
1 0 0 1 0 0 0
1 0 0 0 1 0 0 0
0 0 0 1 0 0 0
0 0 0 1 0 1 0 0
0 0 0 0 1 2 0 1
= {F [N], F [n-1], F [N-2], (n + 1) ^ 2, N + (n + 1}
What do you think ?? Starting with N ^ 2-> (n + 1) ^ 2 and N-> n + 1, (n + 1) ^ 2-N ^ 2 = 2n + 1, so we have 2n and 1, N + 1-N = 1, so we have 1. (In fact, we need to consider the extra 2n, but there is only one item, so it is integrated into it .)
Of course, the above is not the simplest and can be simplified, but it is a constructor =
--------------------------------------
Consider adding a constant of 8 to easily write it out:
{F [n-1], F [N-2], F [n-3], n ^ 2, N, 2n, 8}
*
2 1 0 0 0 0 0 0 0
6 0 1 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0
1 0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 1 0 0 0
0 0 0 0 1 2 0 1 0
0 0 0 0 0 0 0 1
= {F [N], F [n-1], F [N-2], (n + 1) ^ 2, N + (n + 1), 8}
Recursive Summary of matrix rapid Power Optimization