There are a two problems:

- rsolve is unhappy when the index variable is inside a function. sin,
cos, exp, etc. should be special cased because they can be represented
as e**n. Could you report an issue about this on the google code site?

- Even after I remove cos(n) from your equation and plug in
x**n+x**(-n) it does not work. This is because of the initial
conditions. If I remove also the initial conditions there is an
answer:

>>> ans = rsolve(y(n+2)-4*y(n+1)+4*y(n)-2**n+x**n+x**(-n), y(n))
>>> ans
-2**n*C0 + 2**n*C0*RisingFactorial(C0/C1 + 1,
n)/RisingFactorial(C0/C1, n) - 2**n*C1*n - 2**n*n**2/8 +
x**2*x**(-n)/(4*x**2 - 4*x + 1) + x**n/(x**2 - 4*x + 4)

Then when I try to solve for C0 or C1 solve raises an error
(NotImplementedError) because it does not know how to solve it.

Instead of raising an error in this case, rsolve returns None, which I
consider a second bug.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to