Function Repository Resource:

LogDifferences

Source Notebook

Find logarithmic differences of elements in a list

Contributed by: Stephen Wolfram

ResourceFunction["LogDifferences"][list]

gives the logarithmic differences of elements in list.

Details and Options

ResourceFunction["LogDifferences"][list] for a list with elements of the form np is equivalent to ConstantArray[p,Length[list]-1].

Examples

Basic Examples (1) 

Log differences for a length-n list of powers gives a list with n-1 copies of the exponent:

In[1]:=
ResourceFunction["LogDifferences"][Table[n^3, {n, 10}]]
Out[1]=

Scope (1) 

Use a symbolic list:

In[2]:=
ResourceFunction["LogDifferences"][Array[C, 5]]
Out[2]=

Applications (3) 

Find the connectivity graph for a Sierpiński mesh:

In[3]:=
sm = MeshConnectivityGraph[SierpinskiMesh[5], {2, 2}, 0]
Out[3]=

Find successive average graph neighborhood volumes with the resource function GraphNeighborhoodVolumes:

In[4]:=
MeanAround /@ Transpose[
  Values[ResourceFunction["GraphNeighborhoodVolumes"][sm, All, Automatic]]]
Out[4]=

Plot the log differences, which show an effective dimension around 1.58:

In[5]:=
ListLinePlot[ResourceFunction["LogDifferences"][%]]
Out[5]=

Version History

  • 2.0.0 – 24 March 2020
  • 1.0.0 – 04 December 2019

Related Resources

License Information