4

I need to find (or guess?) the symbolic functional form of aFun[n] for a general n (where n>=1). Anyone can help?

aFun[n_] :=
 Block[
  {a},
  a[-1, 0] = 0;
  a[n + 1, 0] = 0;
  a[-1, 1] = 0;
  a[n + 1, 1] = 0;
  With[{eqs = 
     Table[{a[i, 0] == 
         i /n ( v + 
             b (alpha a[i, 0] + (1 - alpha) a[i - 1, 0])) + (1 -
              i /n) (v - p + 
             b (alpha a[i + 1, 1] + (1 - alpha) a[i, 1])), 
        a[i, 1] == 
         i /n ( v + 
             b (alpha a[i, 0] + (1 - alpha) a[i - 1, 0])) + (1 -
              i /n) (v - p (1 - w) + 
             b (alpha a[i + 1, 1] + (1 - alpha) a[i, 1]))}, {i, 
        0, n}, {x, 0, 1}] // Flatten, 
    vars = Table[a[i, x], {i, 0, n}, {x, 0, 1}] // Flatten}, 
   a[0, 0] /. First@Solve[eqs, vars]]
  ]
Monire Jalili
  • 315
  • 1
  • 7
  • Recurrence is of order 2, so you need one more initial condition. – Vaclav Kotesovec Mar 26 '21 at 19:41
  • I don't think that's the issue; adding one doesn't produce a result, and mathematica usually includes undetermined constants if the solution is underdetermined anyway, so that shouldn't be an issue. It might simply be not solvable by mathematica... – thorimur Mar 26 '21 at 19:56
  • The start condition you specify is simply the recursion, therefore you can not determine a[0] from this information. More info is needed. The start condition must be independent from the recursion. – Daniel Huber Mar 26 '21 at 20:01
  • Thanks for the comments. I do not have any other conditions to add. Say m = 4, we will have 5 equations in this series with five unknowns: a[0], a[1], a[2], a[3], a[4]. Why we would need any additional info? – Monire Jalili Mar 26 '21 at 20:22
  • I believe you only have 4 equations in the original, relating the following sets of variables: a[0], a[1]; a[0], a[1], a[2]; a[1], a[2], a[3]; a[2], a[3], a[4]. The example seems to include a3 twice in the final equation. – thorimur Mar 26 '21 at 20:55
  • Sorry, that was a typo, I fixed it. – Monire Jalili Mar 27 '21 at 01:15
  • What is the purpose of the {x, 0, 1}? It just seems to produce duplicates in the eqs and vars lists. – Somos May 04 '22 at 01:35
  • Let's say n=3, then we have 8 equations and 8 variables. We have 2(n+1) distinct equations and 2(n+1) distinct variables. – Monire Jalili May 04 '22 at 19:53

1 Answers1

5

I'm not totally sure RSolve is the best way to approach this; I'm also not sure the below is the best way to approach it either! But I was able to get it to work:

a0[m_] := Block[{a},
  a[-1] = 0; a[m + 1] = 0; 
  With[{eqs = Table[a[n] == n/m (v + b a[n - 1]) + (1 - n/m) (v - p + b a[n + 1]), {n, 0, m}],
        vars = Table[a[n], {n, 0, m}]}, 
       a[0] /. First @ Solve[eqs, vars]]]
thorimur
  • 9,010
  • 18
  • 32