Function Repository Resource:

FunctionPeriodPlot

Source Notebook

Plot a given number of periods of a periodic function

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["FunctionPeriodPlot"][f,x]

plots one period of a periodic function f of x.

ResourceFunction["FunctionPeriodPlot"][f,x,n]

plots n periods of a periodic function f of x.

Details and Options

The function to plot, f, is expected to be periodic in the variable x.
"PeriodAlignment"Centerdetermine where to align the period relative to the starting point using the values Left,Right or Center
"StartingPoint"0where to start plotting the period
ResourceFunction["FunctionPeriodPlot"] also takes all options of Plot.
The options "StartingPoint" and "PeriodAlignment" work in tandem to determine the plot.

Examples

Basic Examples (1) 

Plot a single period of a periodic function:

In[1]:=
ResourceFunction[
 "FunctionPeriodPlot", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[x], x]
Out[1]=

Scope (1) 

Plot two periods of a periodic function:

In[2]:=
ResourceFunction[
 "FunctionPeriodPlot", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Tan[x], x, 2]
Out[2]=

Options (1) 

Use "StartingPoint" to determine the base point and "PeriodAlignment" to determine whether or not to plot the period(s) centered around, to the right of or to the left of that point:

In[3]:=
Table[Labeled[
  ResourceFunction[
   "FunctionPeriodPlot", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[x], x, 2, "StartingPoint" -> Pi/2, "PeriodAlignment" -> place], place], {place, {Center, Right, Left}}]
Out[3]=

Possible Issues (1) 

FunctionPeriodPlot returns unevaluated when the input expression is not periodic:

In[4]:=
ResourceFunction[
 "FunctionPeriodPlot", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][x^2, x]
Out[4]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.0 – 23 March 2023
  • 1.0.0 – 26 October 2020

Related Resources

Author Notes

To view the full source code for FunctionPeriodPlot, evaluate the following:

In[1]:=
SystemOpen[
 FileNameJoin[{DirectoryName[FindFile["ResourceFunctionHelpers`"]], "FunctionPeriodPlot.wl"}]]

License Information