kill(all)$

part 3 : solve Ricatti equation (revision 1)
peter.vlasschaert@gmail.com,08/02/2017

batch(solve_rec)$

Ricatti equation :

eq1:x[i+1]*x[i]+A*x[i+1]+B*x[i]+C = 0;

use : translational subst. remove 'Constant term'

p1:x[i]=z[i]+delta;
p2:x[i+1]=z[i+1]+delta;

eq2:subst(rhs(p1),lhs(p1),eq1);
eq3:factor(subst(rhs(p2),lhs(p2),eq2));

eq4:ev(eq3,z[i+1]=0,z[i]=0);
eq5: factor(lhs(eq3)-lhs(eq4)=0);

eq6:t=z[i+1]*z[i];
eq7:ratsubst(lhs(eq6),rhs(eq6),eq5);
eq8:coeff(lhs(eq7),z[i+1]);
eq9:coeff(lhs(eq7),z[i]);

eq10:(lhs(eq7)-t)/t = -t/t;

eq11:ratsubst(rhs(eq6),lhs(eq6),lhs(eq10))=rhs(eq10);

eq12:part(lhs(eq11),1,1)/rhs(eq6);
eq13:part(lhs(eq11),1,2)/rhs(eq6);
eq14:part(lhs(eq11),2);

eq15:subst(v[i],1/z[i],eq12);
eq16:subst(v[i+1],1/z[i+1],eq13);

eq17:eq15+eq16=rhs(eq11);

build in method: solve_rec

solution = general+particular

eq18:solve_rec(eq17,v[i]);

second difference equation ,nonhomgeous

eq19:subst(E*v[i],v[i+1],eq17);
eq20:factor(eq19);

other way to solve =>

solution = general+particular

general

eq21:part(eq20,1,1);
eq22:coeff(eq21,E);
eq23:ev(eq21,E=0);
eqq:rr = - eq23/eq22;

particular:

v[i+1]*a1+v[i]*a2=f(i)
f(i) = -1 = -1 * 1^i, E=1,invers operator,found from eq20
rem : f(i) = -1*E^i,E=1

eq24:solve(eq20,v[i])[1];
eq25:subst(1,E,eq24);

gen1:v[i]=constant*(rhs(eqq))^i+rhs(eq25);

general solution : x[i]

gen:1/(x[i]-delta)=rhs(gen1);