       Re: Re: Help on a recursive function

• To: mathgroup at smc.vnet.net
• Subject: [mg53099] Re: [mg53057] Re: Help on a recursive function
• From: DrBob <drbob at bigfoot.com>
• Date: Thu, 23 Dec 2004 07:59:05 -0500 (EST)
• References: <200412160840.DAA27279@smc.vnet.net> <cpue6s\$gb6\$1@smc.vnet.net> <200412220952.EAA04431@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I think this matches your new "complete formal":

Clear@p
p[H_][i_Integer] /; 0 â?¤ i < H := p[H][i] = a(1 + b)^i
p[H_][i_Integer?Positive] := p[H][i] =
Simplify[(1 + b)p[H][i - 1] - b p[H][i - H - 1]]

But that leaves things undefined. For instance:

p
a + a*b - b*p[-1]

and

p
a*(1 + b)^2 - b*p[-1]

You haven't defined p at -1.

Bobby

On Wed, 22 Dec 2004 04:52:47 -0500 (EST), Smoll Est <smollest at supereva.it> wrote:

> DrBob wrote:
>> If I've copied the definition right, here are a few terms for H = 1, 2, and 3:
>>
>> Clear@p
>> p[H_][i_Integer] /; 0 <= i < H := p[H][i] = a(1 + b)^i
>> p[H_][i_Integer?Positive] := p[H][i] =
>>    Simplify[(1 + b)p[H][i - 1] - b p[H][i - H]]
>>
>> p /@ Range@5
>> {a, a, a, a, a}
>
> Hello Bobby,
> thank you for your attention first of all; I made a *mistake* in the
>
>>> P(i) = (1+b)P(i-1) - b P(i-H)    i>= H
>
> the true formula is:
>
> P(i) = (1+b)P(i-1) - b P(i-H-1)    i>= H
>
> that is "P(i-H-1)" instead of "P(i-H)"
>
> and the limit where:
>
> a / (1-b)
>
> so, the complete formal is:
>
> P(i) = a(1+b)^i     i=0, ..., H-1
>
> P(i) = (1+b)P(i-1) - b P(i-H-1)    i>= H
>
> any idea for its expression in a closed form?
>
> smoll-est
>
>
>
>

--
DrBob at bigfoot.com
www.eclecticdreams.net

```

• Prev by Date: Re: Mathematica language issues
• Next by Date: Re: Sequential evaluation of lists
• Previous by thread: Re: Help on a recursive function
• Next by thread: help on a recursive function