Position
Usage
Notes
Further Examples
The symbol c occurs in the third position of this list.
In[1]:=
|
Out[1]=
|
This gives the positions of the elements of the list that are manifestly powers.
In[2]:=
|
Out[2]=
|
We will find the positions of symbols in this list. Here are the heads of this list.
In[3]:=
|
Out[3]=
|
Besides the first two elements of the expression, the head of the expression (List in position ) also has head Symbol.
In[4]:=
|
Out[4]=
|
Here are the numbers from to in steps of . The number occurs at position .
In[5]:=
|
Out[5]=
|
In[6]:=
|
Out[6]=
|
These numbers are imprecise, so this attempt to find the position of fails.
In[7]:=
|
Out[7]=
|
Using a test succeeds.
In[8]:=
|
Out[8]=
|
The function ConsecutiveOccurrences1 gives the starting positions of all instances of n consecutive identical elements in a list.
In[9]:=
|
Here is a list.
In[10]:=
|
There are consecutive occurrences of identical elements in mm beginning at positions , , and .
In[11]:=
|
Out[11]=
|
The function ConsecutiveOccurrences2 does the same thing as ConsecutiveOccurrences1.
In[12]:=
|
In[13]:=
|
Out[13]=
|
The defined function PositionsOfRuns returns the first and last positions of any runs in a list.
In[14]:=
|
In[15]:=
|
Out[15]=
|
The longest run of digits of among the first decimal places occurs from the rd to the th. The calculation uses digits so that roundoff error will not affect the final result.
In[16]:=
|
Out[16]=
|
In[17]:=
|
|