# Mathematica syntax problem

1. Jan 31, 2008

### ehrenfest

1. The problem statement, all variables and given/known data
When I type
into mathematica 6 why does it give me
and not just
?

2. Relevant equations

3. The attempt at a solution

2. Jan 31, 2008

### NateTG

Could be an off-by-one. What does:
Code (Text):

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

give?

3. Jan 31, 2008

### ehrenfest

same thing.

Code (Text):
{{a[n] -> Fibonacci[n] - C[2] Fibonacci[n] + C[2] LucasL[n]}}
I think its a bug.

4. Jan 31, 2008

### NateTG

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

Code (Text):

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

or
Code (Text):

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

seem more consistent.

5. Jan 31, 2008

### R.Harmon

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?

6. Jan 31, 2008

### EnumaElish

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])}}

7. Jan 31, 2008

### ehrenfest

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.