I'm trying to have Mathematica simplify and calculate the value of the first term of a sequence, defined recursively from an initial arbitrary n.

$P(n)=\frac{1}{2} (-V(n-1)+V(n)+R)$, where $V(n)$ is another arbitrary function, and $n$ is a natural number. The rest is defined by $P(k)=\frac{1}{2} \left(-\sum _{i=k+1}^n P(i)-V(k-1)+V(n)+R\right)$. I realise this is arbitrary, but I'd like to see if it simplifies to anything nice, and I need to run it for several functions $V$ and, ideally, arbitrary $n$.

I tried

RecurrenceTable[{P[k] == (V[n] + R - V[k - 1] - Sum[P[i], {i, k + 1, n}])/2, 
P[n] == (V[n] + R - V[n - 1])/2}, P, {k, n, 1}]

But I'm getting errors about recursion depth. Is there any way to do what I'm trying?


1 Answer 1

Clear[P, k, n];
P[k_Integer?Positive, n_Integer?Positive] := 
 Piecewise[{{(V[n] + R - V[n - 1])/2, 
    k == n}, {(V[n] + R - V[k - 1] - Sum[P[i], {i, k + 1, n}])/2, 0 < k < n}}]

The first term (k == 1) for an arbitrary positive integer n is (V[n] + R - V[0] - Sum[P[k], {k, 2, n}])/2

Verifying for n up to 50

And @@ Table[P[1, n] == (V[n] + R - V[0] - Sum[P[k], {k, 2, n}])/2, {n, 50}]

(* True *)

Without specifying V and/or P it cannot be simplified further.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.