First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 12 years ago

blu3 gravatar image

Recurrence equation value error

Hello, As an anxious student I tried googling for an answer for 2hours without any result. I'm new Sagemath user.

I have to solve equation:

a[n+2]-4*a[n+1]+4*a[n]=2^n+cos(n*pi/2), a[0]=1, a[1]=2

My sage input is:

from sympy import *
y = Function('y')
n = Symbol('n',integer=True)

rsolve(y(n+2)-4*y(n+1)+4*y(n)-2^n-cos(n*pi/2), y(n), {y(0):1,y(1):2})

But I'm getting an error:

ValueError: 'y' expected, got 'cos'

Sage has some problems with cosine function, any idea how to solve it?