Why isn't Mathematica giving me the desired output for this RSolve equation?

  • Topic: Mathematica 
  • Thread starter Thread starter ehrenfest
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
6 replies · 3K views
ehrenfest
Messages
2,001
Reaction score
1

Homework Statement


When I type
RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1 && a[2] == 1}, a[n], n]
into mathematica 6 why does it give me
{{a[n] -> Fibonacci[n] - C[2] Fibonacci[n] + C[2] LucasL[n]}}
and not just
{{a[n] -> Fibonacci[n] }}
?


Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
Could be an off-by-one. What does:
Code:
RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1 && a[0] == 1}, a[n], n]
give?
 
same thing.

Code:
{{a[n] -> Fibonacci[n] - C[2] Fibonacci[n] + C[2] LucasL[n]}}

I think its a bug.
 
Hmm, is the syntax you're using correct? (I'm not a mathematica user.)

Code:
RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1 , a[0] == 1}, a[n], n]
or
Code:
RSolve[{a[n] == a[n - 1] + a[n - 2] &&  a[1] == 1 && a[0] == 1}, a[n], n]
seem more consistent.
 
I tried it and it just gives {{a[n] -> Fibonacci[n] }} for me. Not sure why, my mathematica knowledge isn't that great, but like you said could just be a bug?
 
In Math'ca 6.0.1.0,

RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1 && a[2] == 1}, a[n], n]

gives

{{a[n] -> Fibonacci[n]}}

whereas

RSolve[{a[n] == a[n - 1] + a[n - 2], a[1] == 1, a[0] == 1}, a[n], n]
and
RSolve[{a[n] == a[n - 1] + a[n - 2] && a[1] == 1 && a[0] == 1}, a[n], n]

both give

{{a[n] -> 1/2 (Fibonacci[n] + LucasL[n])}}
 
Yes. You're right. I just did a Clear["Global`*"] and began getting the same answer as you. I am not really sure how why the Clear["Global`*"] would change the evaluation of this though...it seems like all variables should be local.