SequenceFoldList

SequenceFoldList[f,{x1,,xn},{a1,a2,}]

gives {x1,,xn,f[x1,,xn,a1],f[x2,,xn,f[x1,,xn,a1],a2],}.

SequenceFoldList[f,{x1,,xn},{a1,a2,},k]

applies f to k arguments at each step, with the first n coming from the xi or previous results, and the last k-n coming from the ai.

Details

  • In SequenceFoldList[f,{x1,,xn},{a1,a2,}], the function f is assumed to take n+1 arguments.
  • If xlist and alist are lists of length n and m respectively, then SequenceFoldList[f,xlist,alist] returns a list of length n+m. Any or both of n and m can be zero.
  • SequenceFoldList[f,{x},{a,b,}] is equivalent to FoldList[f,x,{a,b,}].
  • SequenceFoldList[f,{x1,,xn},{a1,a2,}] is equivalent to SequenceFoldList[f,{x1,,xn},{a1,a2,},n+1].
  • If xlist and alist are lists of length n and m respectively, then SequenceFoldList[f,xlist,alist,k] returns a list of length Max[2n+m-k+1,n]. Any of n, m, k can be zero, as long as kn.

Examples

open allclose all

Basic Examples  (2)

Scope  (2)

Take one element of the third argument at each step:

Take several elements of the third argument at each step:

Applications  (2)

Fibonacci sequence:

Show convergence to the exact solution when increasing the order of extrapolation:

Properties & Relations  (10)

SequenceFold[f,xlist,alist] returns the last element of SequenceFoldList[f,xlist,alist]:

Each element of the result of SequenceFoldList[f,xlist,alist] is constructed from the previous one and an element of alist:

Each element of the result of SequenceFoldList[f,xlist,alist,k] is constructed from the previous one and several elements of alist:

SequenceFold gives the last element of the result of SequenceFoldList:

Starting with a seed sequence of length 1 makes SequenceFoldList equivalent to FoldList:

An empty seed sequence makes SequenceFoldList equivalent to Map:

If the list in the third argument is empty, then the seed sequence is returned:

This is equivalent to applying f to a partitioned list:

If f has only one argument, then SequenceFoldList is equivalent to NestList:

The number of arguments of the function cannot be smaller than the length of the seed sequence:

If they are equal, then the actual elements of the list in the third argument are not used:

Wolfram Research (2015), SequenceFoldList, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceFoldList.html.

Text

Wolfram Research (2015), SequenceFoldList, Wolfram Language function, https://reference.wolfram.com/language/ref/SequenceFoldList.html.

BibTeX

@misc{reference.wolfram_2020_sequencefoldlist, author="Wolfram Research", title="{SequenceFoldList}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/SequenceFoldList.html}", note=[Accessed: 26-February-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_sequencefoldlist, organization={Wolfram Research}, title={SequenceFoldList}, year={2015}, url={https://reference.wolfram.com/language/ref/SequenceFoldList.html}, note=[Accessed: 26-February-2021 ]}

CMS

Wolfram Language. 2015. "SequenceFoldList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequenceFoldList.html.

APA

Wolfram Language. (2015). SequenceFoldList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequenceFoldList.html