Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Subdivide an interval such that the ratio of subsequent elements is constant
ResourceFunction["PowerSubdivide"][xmax,n] generates the list of values obtained by subdiving the interval from 1 to xmax into n parts such that the ratio of subsequent elements is constant. | |
ResourceFunction["PowerSubdivide"][xmin,xmax,n] generates the list of values obtained by subdiving the interval from xmin to xmax into n parts such that the ratio of subsequent elements is constant. |
Subdivide the range 10–10000 in 3 steps:
In[1]:= |
Out[1]= |
With two arguments, the start of the sequence is assumed to be 1:
In[2]:= |
Out[2]= |
PowerSubdivide works on symbolic entries:
In[3]:= |
Out[3]= |
xmin can be larger than xmax:
In[4]:= |
Out[4]= |
PowerSubdivide gives points that are "logarithmically useful" for plotting on a logarithmic scale:
In[5]:= |
Out[5]= |
The ratio between subsequent values is constant:
In[6]:= |
Out[6]= |
PowerSubdivide is related to Subdivide:
In[7]:= |
Out[7]= |
Negative and positive end points results in intermediate values in the complex plane:
In[8]:= |
Out[8]= |
Calculate the geometric mean of two values:
In[9]:= |
Out[9]= |
Compare to the built-in function:
In[10]:= |
Out[10]= |
If the start or end is a negative number, intermediate values might be complex numbers:
In[11]:= |
Out[11]= |
If both end points are negative real numbers, Chop might be needed to remove approximate zeros:
In[12]:= |
Out[12]= |
In[13]:= |
Out[13]= |
Because Log(0) equals -∞, all but the last entry will be 0:
In[14]:= |
Out[14]= |
Connect pairs of random complex numbers:
In[15]:= |
Out[16]= |
This work is licensed under a Creative Commons Attribution 4.0 International License