kill(all)$

matrix : power of a matrix ( = Fibonacci sequence).,part 1
peter.vlasschaert@gmail.com, 03/02/2020

load packages :
===========

load(lrats)$
load(solve_rec)$

see : CASINO ,website.

Fibonacci sequence (= Difference equation)
=================================

Mathematical Model : Fibonacci,n =integer
F(0) =0                                             (1)   BC
F(1) =1                                             (2)   BC
F(n) = F(n-1)+F(n-2),  n=2,3,.....       ( 3)   Difference equation

How to solve (3)
--------------------

p1a:F(0) = 0;
p1b:F(1) = 1;
p1:F(n) =F(n-1) +F(n-2);

use : p1;

p2:solve_rec(p1,F(n));
p2a:ratsimp(p2);
p2b:combine(p2);

find :%k[1],%k[2]
---------------------

bc1:subst([n=0],rhs(p2)) = 0;
bc2:subst([n=1],rhs(p2))  =1;

find : F(n)
-------------

p3:eliminate([p2,bc1,bc2],[%k[1],%k[2]]);

p3a:solve(p3,F(n))[1];

check:
=====

p4a:subst([n=0],p3a);
p4b:subst([n=1],p3a);
p4c:round(ev(subst([n=2],p3a),float));
p4d:round(ev(subst([n=3],p3a),float));
p4e:round(ev(subst([n=4],p3a),float));

Fibonacci sequence
===============

list: n=0...4, F(n)
---------------------

p5:makelist(subst([n=i],rhs(p3a)),i,0,4);

p5a:ev(p5,float);

p5b:round(p5a);

rem :round works on list

Characteristic polynoom:
==================

general equation : Difference equations(second order)
========================================

p6:a2*a[n+2]+a1*a[n+1]+a0*a[n]=0;

n=> n+2 , n =0,1,2,..

p6a:subst([n=n+2],p1);

p6b:lhs(p6a) -rhs(p6a) =0;

  => a2 = 1,a1 = -1,a0 = -1
-----------------------------------

p6c1:a2 = 1;
p6c2:a1 = -1;
p6c3:a0 = -1;

Characteristic polynoom:
==================

 => a2*r^2+a1*r+a0 = 0
-------------------------------

p7:a2*r^2+a1*r+a0 = 0;
p7a:subst([p6c1,p6c2,p6c3],p7);

Golden Ratio
----------------

 ========================================

p7b:solve(p7a,r);

p7b1:float(p7b);

rem : 1/r=1+r

p8:1/r=1+r;
p8a:solve(p8,r);
p8b:float(p8a);

 ========================================