4
$\begingroup$

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]]
  ]
$\endgroup$
8
  • $\begingroup$ Recurrence is of order 2, so you need one more initial condition. $\endgroup$ Mar 26, 2021 at 19:41
  • $\begingroup$ 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... $\endgroup$
    – thorimur
    Mar 26, 2021 at 19:56
  • $\begingroup$ 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. $\endgroup$ Mar 26, 2021 at 20:01
  • $\begingroup$ 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? $\endgroup$ Mar 26, 2021 at 20:22
  • $\begingroup$ 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. $\endgroup$
    – thorimur
    Mar 26, 2021 at 20:55

1 Answer 1

5
$\begingroup$

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]]]
$\endgroup$
2
  • $\begingroup$ This was super helpful. Thanks alot $\endgroup$ Mar 27, 2021 at 3:01
  • $\begingroup$ Curiously, a general solution for a[0] in terms of m seems to be a[0] -> ((-m + (m - 1) b) p + (m - (m - 2) b) v)/(m - 2 (m - 1) b + (m - 2) b^2) $\endgroup$ May 6 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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