I have a set of coefficients $A_{i}^N$ where $i=0,\dots, N$ that obey a recursion relation that takes the form

$$A_i^N = C_i^N-\sum_{M=1}^N\sum_{k=0}^{N-M}A_k^{N-M}\psi_{i,k}^{N,M}$$

The coefficients $C_i^N$ and $\psi_{i,k}^{M,N}$ are known. So if we prescribe $A_0^0$ the recursion relation defines all $A_i^N$.

I wanted to use Mathematica to implement this and starting from a given value of $A_0^0$ determine any $A_i^N$ I choose as a function of $C_i^N$ and the appropriate $\psi_{i,k}^{N,M}$.

Now, I'm not sure how to do this. I know about RSolve that tries to explicitly solve a recursion relation. This one is too complicated and I don't expect it even to be possible to give one general formula for all $A_i^N$. What I want is a bit different than RSolve. What I want is really give $A_0^0$ and evaluate any $A_i^N$, say $A^2_0$ and get it symbolically in terms of the coefficients that are known.

How can I do this?

  • $\begingroup$ Isn't A[0,0] already prescribed to be C[0,0]? $\endgroup$
    – lericr
    Jun 21, 2023 at 16:52
  • $\begingroup$ No, because the recursion relation only applies for $N\geq 1$. $\endgroup$ Jun 21, 2023 at 18:17

2 Answers 2


(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)


Use Format to display index variables as Subsuperscript

(Format[#[i_, n_]] := Subsuperscript[#, i, n]) & /@ {A, c};

Format[ψ[i_, k_, n_, m_]] := 
  Subsuperscript[ψ, Row@{i, ",", k}, Row@{n, ",", m}];

Use memoization to trade storage use for efficiency.

A[i_Integer?NonNegative, n_Integer?Positive] := A[i, n] =
  c[i, n] - Sum[A[k, n - m]*ψ[i, k, n, m], {m, 1, n}, {k, 0, n - m}]


A[0, 2]

enter image description here


Is this sufficient?

A[i_, n_Integer?Positive] := 
  C[i, n] - Sum[Sum[A[k, n - m] Psi[i, k, n, m], {k, 0, n - m}], {m, 1, n}]

A[0, 2]
(* C[0, 2] - (C[0, 1] - A[0, 0] Psi[0, 0, 1, 1]) Psi[0, 0, 2, 1] - 
   A[0, 0] Psi[0, 0, 2, 2] - Psi[0, 1, 2, 1] (C[1, 1] - A[0, 0] Psi[1, 0, 1, 1]) *)

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.