Skip to main content
Mathematics LibreTexts

11.7.2: Mathematica program

  • Page ID
    143505
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    Iterations

    The following command produces a list of the first niterations of the function \(f(x)=a x+b\) with initial value \(x_0\).

    Iteration \(\left[\mathrm{a}_{-}, \mathrm{b}_{-}, \mathrm{x}_{-}, \mathrm{n}_{-}\right]:=\operatorname{NestList}[\) Function \([x, a x+b], \mathrm{x} 0, n]\)
    Here is an example: \(f(x)=1.1 x-2.3\), with initial value \(x_0=0.4\), and 100 iterations. The sequence of iterations seems to diverge.

    Iteration \([1.1,-2.3,0.4,100]\)
    \(\{0.4,-1.86,-4.346,-7.0806,-10.0887,-13.3975,-17.0373,-21.041,-25.4451\), \(-30.2896,-35.6186,-41.4804,-47.9285,-55.0213,-62.8235,-71.4058,-80.8464\), \(-91.231,-102.654,-115.22,-129.041,-144.246,-160.97,-179.367,-199.604,-\) \(221.864,-246.351,-273.286,-302.914,-335.506,-371.356,-410.792,-454.171\), \(-501.888,-554.377,-612.115,-675.627,-745.489,-822.338,-906.872,-999.859\), \(-1102.15,-1214.66,-1338.43,-1474.57,-1624.32,-1789.06,-1970.26,-2169.59\), \(-2388.85,-2630.03,-2895.34,-3187.17,-3508.19,-3861.31,-4249.74,-4677.01\), \(-5147.01,-5664.01,-6232.71,-6858.29,-7546.41,-8303.35,-9135.99,-10051.9\), \(-11059.4,-12167.6,-13386.7,-14727.6,-16202.7,-17825.3,-19610.1,-21573.4\), \(-23733.1,-26108.7,-28721.8,-31596.3,-34758.3,-38236.4,-42062.3,-46270.8\), \(-50900.2,-55992.6,-61594.1,-67755.8,-74533.7,-81989.4,-90190.6,-99212 .\), -109135., -120051., -132059., -145267., -159796., -175778., -193358., -212696., -233968., -257367., -283106., -311419.\}

    Here are the first 80 iterations of the function \(f(x)=0.8 x+2.313\) with initial value \(x_0=114.7\). The sequence of iterations seem to converge,

    Iteration \([0.8,2.313,114.7,80]\)
    \(\{114.7,94.073,77.5714,64.3701,53.8091,45.3603,38.6012,33.194,28.8682\), 25.4075, 22.639, 20.4242, 18.6524, 17.2349, 16.1009, 15.1937, 14.468, 13.8874, \(13.4229,13.0513,12.7541,12.5163,12.326,12.1738,12.052,11.9546,11.8767\), \(11.8144,11.7645,11.7246,11.6927,11.6671,11.6467,11.6304,11.6173,11.6068\),\(11.5985,11.5918,11.5864,11.5821,11.5787,11.576,11.5738,11.572,11.5706\), \(11.5695,11.5686,11.5679,11.5673,11.5668,11.5665,11.5662,11.5659,11.5658\), \(11.5656,11.5655,11.5654,11.5653,11.5652,11.5652,11.5652,11.5651,11.5651\), \(11.5651,11.5651,11.5651,11.565,11.565,11.565,11.565,11.565,11.565\), \(11.565,11.565,11.565,11.565,11.565,11.565,11.565,11.565,11.565\}\)


    11.7.2: Mathematica program is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?