Skip to content

FixedPointList ​

Applies a function repeatedly, collecting every value up to the fixed point.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageFixedPointList✓
FixedPointList(f, x){x,f(x),f(f(x)),… }\{x, f(x), f(f(x)), \dots\}, stopping once two consecutive values are structurally the same — the repeated value ends the list once.
Typed signatures
TypePackageApplies
(any, any) -> list<any>combinatoricsalways

Domain: Collections

Details
  • Stops on exact structural equality (Wolfram's SameQSameQ), not the numeric-precision agreement FixedPoint additionally uses for an inexact sequence — adequate for exact/rational values, which is what every example here uses.
  • Capped at 4096 applications of ff, same as NestWhile.

Examples

Basic #

halve and floor down to 0, ending with the repeated fixed point

live ↗
InFixedPointList(_1⁡↦⌊_1⁡2⌋,10)\mathrm{FixedPointList}(\operatorname{\_1}↦\lfloor\frac{\operatorname{\_1}}{2}\rfloor, 10)Out[10,5,2,1,0,0]\bigl\lbrack10, 5, 2, 1, 0, 0\bigr\rbrack

The halving orbit, ending when two consecutive values repeat

live ↗
InFixedPointList(_1⁡↦1+⌊_1⁡2⌋,1 000)\mathrm{FixedPointList}(\operatorname{\_1}↦1+\lfloor\frac{\operatorname{\_1}}{2}\rfloor, 1\,000)Out[1 000,501,251,126,64,33,17,9,5,3,2,2]\bigl\lbrack1\,000, 501, 251, 126, 64, 33, 17, 9, 5, 3, 2, 2\bigr\rbrack
Applications #

Orbit of n↦11π(n)+1n \mapsto 11\pi(n) + 1 from 22, growing for many steps before it settles

live ↗
InFixedPointList(_1⁡↦11PrimePi(_1⁡)+1,2)\mathrm{FixedPointList}(\operatorname{\_1}↦11\mathrm{PrimePi}(\operatorname{\_1})+1, 2)Out[2,12,56,177,441,936,1 739,2 971,4 720,6 986,9 879,13 399,17 480,22 111,27 270,32 825,38 710,44 859,51 272,57 707,64 285,70 808,77 111,83 348,89 497,95 316,101 080,106 459,111 651,116 469,121 012,125 302,129 361,133 178,136 720,140 075,143 166,146 026,148 622,150 943,153 198,155 365,157 312,159 149,160 678,162 141,163 472,164 671,165 793,166 739,167 553,168 356,169 016,169 544,170 017,170 479,170 941,171 392,171 744,172 096,172 415,172 723,173 064,173 350,173 592,173 757,173 933,174 120,174 296,174 450,174 582,174 692,174 813,174 912,175 000,175 077,175 143,175 198,175 198]\bigl\lbrack2, 12, 56, 177, 441, 936, 1\,739, 2\,971, 4\,720, 6\,986, 9\,879, 13\,399, 17\,480, 22\,111, 27\,270, 32\,825, 38\,710, 44\,859, 51\,272, 57\,707, 64\,285, 70\,808, 77\,111, 83\,348, 89\,497, 95\,316, 101\,080, 106\,459, 111\,651, 116\,469, 121\,012, 125\,302, 129\,361, 133\,178, 136\,720, 140\,075, 143\,166, 146\,026, 148\,622, 150\,943, 153\,198, 155\,365, 157\,312, 159\,149, 160\,678, 162\,141, 163\,472, 164\,671, 165\,793, 166\,739, 167\,553, 168\,356, 169\,016, 169\,544, 170\,017, 170\,479, 170\,941, 171\,392, 171\,744, 172\,096, 172\,415, 172\,723, 173\,064, 173\,350, 173\,592, 173\,757, 173\,933, 174\,120, 174\,296, 174\,450, 174\,582, 174\,692, 174\,813, 174\,912, 175\,000, 175\,077, 175\,143, 175\,198, 175\,198\bigr\rbrack
live ↗
InFixedPointList(_1⁡↦d_1⁡dx,x10)\mathrm{FixedPointList}(\operatorname{\_1}↦\frac{\mathrm{d}\operatorname{\_1}}{\mathrm{d}x}, x^{10})Out[x10,10x9,90x8,720x7,5 040x6,30 240x5,151 200x4,604 800x3,1 814 400x2,3 628 800x,3 628 800,0,0]\bigl\lbrack x^{10}, 10x^9, 90x^8, 720x^7, 5\,040x^6, 30\,240x^5, 151\,200x^4, 604\,800x^3, 1\,814\,400x^2, 3\,628\,800x, 3\,628\,800, 0, 0\bigr\rbrack
Properties #
live ↗
InFixedPointList(_1⁡↦ReplaceAll(_1⁡,[Rule(a,b),Rule(b,c),Rule(c,d)]),a2+c3)\mathrm{FixedPointList}(\operatorname{\_1}↦\mathrm{ReplaceAll}(\operatorname{\_1}, \bigl\lbrack\mathrm{Rule}(a, b), \mathrm{Rule}(b, c), \mathrm{Rule}(c, d)\bigr\rbrack), a^2+c^3)Out[c3+a2,d3+b2,d3+c2,d3+d2,d3+d2]\bigl\lbrack c^3+a^2, d^3+b^2, d^3+c^2, d^3+d^2, d^3+d^2\bigr\rbrack
About
Examples5
Checked againstWolfram Language 5 agree
CrosswalkWolfram Language

See also: FixedPoint, NestWhileList