UpTo[n]
represents up to n objects or positions. If n objects or positions are available, all are used. If fewer are available, only those available are used.


UpTo
UpTo[n]
represents up to n objects or positions. If n objects or positions are available, all are used. If fewer are available, only those available are used.
Details

- UpTo is used in functions such as Take, Partition and Eigenvalues that require or allow requesting a specific number of elements to use or return.
Examples
open all close allBasic Examples (7)
Take up to the number of elements available:
Drop up to the number of elements available:
Take up to the number of elements available, dropping what remains, if anything:
Partition into blocks that are up to 3 elements long; the last block is shorter:
Give the 10 most common elements, or as many as are available:
Give the order of the 10 smallest elements, or as many as are available:
Scope (7)
Take up to 20 characters from a string:
Find the 4 largest eigenvalues in a matrix, or as many as there are if fewer:
Create a "ragged" partition where last elements can be shorter:
Obtain the 6 most common elements, or as many as there are if fewer:
Generate a random sample of up to 6 elements, or as many as there are if fewer:
Obtain the first 4 minimal elements, or as many as are available:
Partition an image so that lengths are up to 36 pixels and heights are up to 28 pixels:
Related Guides
History
Text
Wolfram Research (2015), UpTo, Wolfram Language function, https://reference.wolfram.com/language/ref/UpTo.html.
CMS
Wolfram Language. 2015. "UpTo." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UpTo.html.
APA
Wolfram Language. (2015). UpTo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UpTo.html
BibTeX
@misc{reference.wolfram_2025_upto, author="Wolfram Research", title="{UpTo}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/UpTo.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_upto, organization={Wolfram Research}, title={UpTo}, year={2015}, url={https://reference.wolfram.com/language/ref/UpTo.html}, note=[Accessed: 13-August-2025]}