I have trouble in expressing condition recurrence in Mathematica.

I have a conditional recurrence relational, that is conditioned on a function value (defined on sequence index).

where $a_1, a_2, c, b$ are constants.

enter image description here

I tried using the 'Min' function in Mathematica for solving the recurrence relation but it doesn't work. Any idea as to how I can express this such that it can be solved by Mathematica.

  • $\begingroup$ Have you seen Piecewise[]? $\endgroup$ – J. M.'s technical difficulties Feb 5 '17 at 1:23
  • $\begingroup$ Please post an actual example of your problem expressed in Mathematica code. $\endgroup$ – m_goldberg Feb 5 '17 at 5:11
  soln = RSolve[{x[k + 1] == x[k] +
          {a1 b^k, x[k] >= c b^k}},
         a2 b^k],
      x[0] == x0}, x[k], k][[1]];
  If[Length[soln] == 1,
   DiscretePlot[x[k] /. soln, {k, 0, 6},
    PlotLabel -> Style[soln[[1]] // TraditionalForm, 14]],
 {{x0, 0, Subscript[x, 0]}, Range[10],
  ControlType -> SetterBar},
   Control[{{a1, 1, Subscript[a, 1]}, Range[5]}],
   Control[{{a2, 1, Subscript[a, 2]}, Range[5]}],
   Control[{{b, 1}, Range[5]}],
   Control[{{c, 1}, Range[5]}]}]]

enter image description here

| improve this answer | |

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.