I wish to know if I can solve difference equations in Maple. I have searched for solving difference equations in Maple but couldnt get any results. So I wish to solve difference equations in Maple like p_{k+2} - 5*p_{k+1} + 6*p_{k}.
I have tried the following approach:
eq1 := p(k+2) - 5*p(k + 1) + 6*p(k) = 1;
solve(eq1);
but I am getting an undesired output. I am supposed to get
p(k) = A*2^k + B*3^k + 0.5
where A and B are constants.
In Maple, a command for dealing with a recurrence relation like yours is rsolve.
eq1 := p(k+2) - 5*p(k + 1) + 6*p(k) = 1:
sol := rsolve({eq1}, p(k));
-(2*p(0)-p(1))*3^k
-(-3*p(0)+p(1))*2^k
+ 1/2 + 1/2*3^k - 2^k
sort(simplify(sol));
(3*p(0)-p(1)-1)*2^k
+ 1/2*(-4*p(0)+2*p(1)+1)*3^k
+ 1/2