|
Further Examples: Partition
This groups the elements of the original list in pairs; the last element is thrown away.
In[1]:= 
Out[1]= 
This makes triples of elements, with each successive triple offset by elements.
In[2]:= 
Out[2]= 
Here the offset is .
In[3]:= 
Out[3]= 
Define a matrix.
In[4]:= 
Out[4]//MatrixForm= 
This partitions the matrix into blocks of size . The extra elements that do not fit are thrown away; here these are the last row and last column.
In[5]:= 
Out[5]//MatrixForm= 
The indicates an offset at level (the rows) and at level (the columns).
In[6]:= 
Out[6]//MatrixForm= 
Here the element a appears at position of the block and the element y appears at position of the block.
In[7]:= 
Out[7]//MatrixForm= 
This pads with , , and .
In[8]:= 
Out[8]//MatrixForm= 
Here is the direct way to make a cylinder using the package Shapes.
In[9]:= 
In[10]:= 

Here is another approach using Partition. The function makeCylinder[r, h, n] gives the graphic for a cylinder of radius r, height h approximated by n vertical rectangles.
In[11]:= 
In[12]:= 

The function TreeGraphic produces trees with leaves.
In[13]:= 
In[14]:= 

In[15]:= 
|