Ask Your Question

blu3's profile - activity

2023-02-20 11:39:35 +0100 received badge  Taxonomist
2019-03-06 13:10:06 +0100 received badge  Famous Question (source)
2016-07-28 11:21:10 +0100 received badge  Notable Question (source)
2015-03-14 22:31:40 +0100 received badge  Popular Question (source)
2012-06-08 15:22:35 +0100 asked a question 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?