-1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Have you seen Piecewise[]? $\endgroup$ – J. M. will be back soon 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
1
$\begingroup$
Manipulate[
 Module[{soln},
  soln = RSolve[{x[k + 1] == x[k] +
        Piecewise[{
          {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]],
   $Failed]],
 {{x0, 0, Subscript[x, 0]}, Range[10],
  ControlType -> SetterBar},
 Row[{
   Control[{{a1, 1, Subscript[a, 1]}, Range[5]}],
   Spacer[10],
   Control[{{a2, 1, Subscript[a, 2]}, Range[5]}],
   Spacer[10],
   Control[{{b, 1}, Range[5]}],
   Spacer[10],
   Control[{{c, 1}, Range[5]}]}]]

enter image description here

$\endgroup$

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.