# recurrence relation only for odd indices maple

I want to define a recurrence relation $a(n)$ which is only defined for odd n.

I tried something like: a:= (2*n-1)->a(2n-3)+(2n-2)!+a(2n-5);

which apparently doesn't work.

How do I define this properly?

thanks

-
Why not just define $b(n)=b(n-1)+(2b)!+b(n-2)$ and then $a(2n+1)=b(n)$? – Henning Makholm Nov 13 '11 at 4:07
but the problem remains, how do i define a(2n+1) = b(n)? – stefan Nov 13 '11 at 4:25

I'll post this here because it's too much for a comment. If you use the function...

a := m -> a(m-2)+(m-1)!+a(m-4);

You have a recurrence relation defined on all integers. Is it important that your relation remains undefined for even integers?

If you try to evaluate "a(2*n-1);" Maple will complain about too many levels of recursion. This is because it needs base cases. Since the recursion is 4th order, we'll need 4 initial conditions.

If you want it to be arbitrary, you can use...

a(0):=a[0];

a(1):=a[1];

a(2):=a[2];

a(3):=a[3];

Now if you ask Maple about a(5), a(7), etc., it will unwind the recurrence. However, if you ask for a(n), it'll complain about recursion again.

What are you trying to do? Maybe a function isn't the right tool.

-
thanks, I was hoping that i can use maple's rsovle to give me a closed expression – stefan Nov 13 '11 at 4:56
Here's the command to make Maple solve the recurrence with $a(0)=0$ and $a(2)=0$: "rsolve({a(m)=a(m-2)+(m-1)!+a(m-4),a(0)=0,a(2)=0},a(m));" [Make sure the "restart;" to wipe any previous definition of "a".] The expression it spits out isn't pretty. But then again it's not so bad it can't be worked with. – Bill Cook Nov 13 '11 at 5:08