ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 01 Mar 2021 02:01:28 +0100recurrence-rsolve-checkhttps://ask.sagemath.org/question/55961/recurrence-rsolve-check/ I am was testing some ideas and don't understand where this went wrong.
from sympy import Function, rsolve
from sympy.abc import n
y = Function('y');z=Function('z')
f = y(n)-y(n-1)-(-1)^n*binomial(x,n);g=z(n)-z(n-1)-binomial(x,n)
f is the sume of alternating binomial coefficients which is known.
g is just the summation of binomial coefficients (purportedly nonexistent)
frec = rsolve(f,y(n),{y(0):1});grec = rsolve(g,z(n),{z(0):1})
frec
--
zrec
Now this is correct, the alternating sum of binomials
fdiff = frec-(frec.subs({n : n-1}))
simplify(fdiff)
Whereas this is not correct?
gdiff = grec-(grec.subs({n : n-1}))
simplify(gdiff)
Am I missing something in rsolve usage?
rrogersMon, 01 Mar 2021 02:01:28 +0100https://ask.sagemath.org/question/55961/How to solve non_homogenous recurrence in sage using rsolve functions?https://ask.sagemath.org/question/35626/how-to-solve-non_homogenous-recurrence-in-sage-using-rsolve-functions/a(n+1)^2-5a(n+1)^2+6a(n)^2=7n a0=a1=1
I've used rsolve for this recurrence relation but I got the error min() arg is an empty sequence
any help would be appreciated.`from sympy import Function, rsolve,Poly
from sympy.abc import n
b=Function('b')
a=Function('a')
f=(b(n+2))^2-5*(b(n+1))^2+6*(b(n))^2-7*n
inits={b(0):1,b(1):1}
b(n)=rsolve(f,b(n),inits)
b(n)`
the error is:ValueError: min() arg is an empty sequenceM95Thu, 17 Nov 2016 15:27:48 +0100https://ask.sagemath.org/question/35626/Recurrence equation value errorhttps://ask.sagemath.org/question/9049/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?blu3Fri, 08 Jun 2012 15:22:35 +0200https://ask.sagemath.org/question/9049/