# functional equation solver; # solve functional, difference and recurrence equation for function f(x) with independent variable x; # e.g. rsolve( difference(f(x))=x ); rsolve( f(x+1)=f(x)+2 ); #rsolve( difference(f(x_),x_)=y_,x_):=sum(y,x)+C1; #rsolve( difference(f(x))+y_,x_):=sum(-y,x)+C1; #rsolve( -f(x_)+f(x_+1)+z_,x_):=sum(-z,x)+C1; #rsolve( a_-f(x_)+f(x_+1),x_):=sum(-a,x)+C1; #rsolve( -f(x_-1)+f(x_)+z_,x_):=sum(-z,x)+C1; #rsolve( a_-f(x_-1)+f(x_),x_):=sum(-a,x)+C1; #rsolve(a_):=rsolve(a,y); #rsolve(f(x_+1)=f(x_)+f(-1+x_)):=C_1*fibonacci(x); rsolve( a_*f(x_)-f(-1+x_)):=a^(1-x)*C_1; rsolve( a_*f(x_+1)-f(x_)):=a^(1-x)*C_1; rsolve( f(x_)+a_*f(-1+x_)):=(-a)^(x-1)*C_1; rsolve( f(x_+1)+a_*f(x_)):=(-a)^(x-1)*C_1; rsolve( f(x_+1)/f(x_)+a_):=(-a)^(x-1)*C_1; rsolve( f(x_+1)+a_*f(x_)+c_):=(-a)^(x-1)*C_1+c*(-a)^x-c; rsolve( a_*f(x_)+b_*f(1/x_)+c_*x_):=if(a<>b, b*c/(a^2-b^2)/x-a*c/(a^2-b^2)*x); rsolve( f(x_)-f(-1+x_)+a_):=sum(-a,x)+C_1; rsolve( f(x_+1)-f(x_)+a_):=sum(-a,x)+C_1; rsolve( f(x_+1)-f(x_)-1/x_):=H(x); rsolve( f(x_+1)-f(x_)-x_):=x^2/2-x/2+C_1; rsolve( f(x_+1)-f(x_)-x_+c_):=x^2/2-x/2+C_1; rsolve(f(x_+2)-f(x_)-f(1+x_)):=fibonacci(x); rsolve(f(x_+1)-f(x_)*(1+x_)):=x!; rsolve(f(x_+y_)-f(x_)*f(y_)):=exp(x); rsolve(f(x_-y_)-f(x_)/f(y_)):=exp(x); rsolve(f(x_+y_)-f(x_)-f(y_)):=C_1*x; rsolve(f(x_*y_)-f(x_)-f(y_)):=C_1*log(x); rsolve(f(x_*y_)-f(x_)*f(y_)):=C_1*x^n; rsolve(f(x_+y_)-f(x_)*f(y_)/f(x_+y_)):=C_1/x; rsolve(f(x_+y_)+f(x_-y_)-2f(x_)*f(y_)):=cos(x); rsolve(f(x_^n_)-f(x_)^n_):=x^C_1; rsolve(f(2x_)-2f(x_)^2+1):=cos(x); rsolve(f(2x_^2-1)-2f(x_)):=acos(x); rsolve(f(-x)+f(x)):=odd(x); rsolve(f(-x)-f(x)):=even(x); rsolve(f(-x)-1/f(x)):=exp(x); rsolve(f(x+2pi)-f(x)):=trig(x); rsolve(f(g(x))-g(f(x))):=x; rsolve(a_=b_):=rsolve(a-b); rsolve(f(x_^a_)=a_*f(x_)):=log(x); rsolve(f(a_*x_)=a_*f(x_)):=C_1*x; rsolve(f(a_*x_)=a_*f(x_)+c_):=C_1*x-c;