PowerRange

PowerRange[b]

generates the list {1,10,100,,max}, where max is the largest power of 10 that does not exceed b.

PowerRange[a,b]

generates the list {a,10a,100a,,max}, with successive elements increasing by factors of 10.

PowerRange[a,b,r]

uses factors of r instead of 10.

Details

  • PowerRange effectively behaves like Range, but in "log-space".
  • The arguments a and b to PowerRange need not be integers or powers of r, but must be either both positive or both negative.
  • PowerRange starts from a and successively multiplies by r until the result is larger than b.
  • If b/a is not a power of r, the endpoint b will not be included in the list generated by PowerRange.

Examples

open allclose all

Basic Examples  (2)

Generate a list of powers of 10 from 1 to 1 million:

Generate a list of powers of 2 less than a hundred:

Scope  (3)

Specify a power other than 10:

A range with negative numbers:

Parameters need not be numeric:

Properties & Relations  (3)

PowerRange produces lists whose elements have a constant ratio:

Range produces lists whose elements have a constant difference:

PowerRange can be implemented with NestWhileList:

PowerRange produces an explicit list of values with a constant ratio:

RSolveValue generates a formula for generating such a list:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_powerrange, author="Wolfram Research", title="{PowerRange}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/PowerRange.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_powerrange, organization={Wolfram Research}, title={PowerRange}, year={2014}, url={https://reference.wolfram.com/language/ref/PowerRange.html}, note=[Accessed: 21-November-2024 ]}