Function Repository Resource:

TrigDataset

Source Notebook

Get trigonometric datasets including closed-form values

Contributed by: Claudio Lobo Chaib Filho

ResourceFunction["TrigDataset"][f]

gets a dataset for the specified trigonometric function f.

Details and Options

The function f can be any of the following: Sin, Cos or Tan (or "Sine", "Cosine" or "Tangent").
The angles in the generated table are in steps of 3 degrees by default, but it is possible to have closed-form values with different granularity.
ResourceFunction["TrigDataset"] supports the following options:
"Digits"2precision of the "Decimal" result
"DegreeStep"3step size (in degrees) between rows in the result
The "DegreeStep" option accepts Quantity, either as a degree or as radians. If not specified by Quantity, the default is degree.

Examples

Basic Examples (1) 

Generate a dataset for the Sin function:

In[1]:=
ResourceFunction["TrigDataset"][Sin]
Out[1]=

Scope (5) 

Generate some trigonometric data:

In[2]:=
sindata = ResourceFunction["TrigDataset"]["Sine"];

Show all information for a specified row:

In[3]:=
sindata[3]
Out[3]=

Select one of the columns in this row to show the result in standard closed form:

In[4]:=
sindata[3, "Radians"]
Out[4]=

Show the entire row outside of the dataset with StandardForm:

In[5]:=
sindata[3][StandardForm]
Out[5]=

The same thing can be gotten by applying Normal:

In[6]:=
sindata[3] // Normal
Out[6]=

Options (5) 

With the "Digits" option, one can get any precision value for the results in the "Decimal" column:

In[7]:=
ResourceFunction["TrigDataset"][Cos, "Digits" -> 20]
Out[7]=

Use the option "DegreeStep" to specify the difference between the angle at successive rows in the results. Values which are multiples of 1/8 will give results in terms of radicals:

In[8]:=
ResourceFunction["TrigDataset"]["Cosine", "DegreeStep" -> 2][5]
Out[8]=
In[9]:=
ResourceFunction["TrigDataset"]["Cosine", "DegreeStep" -> 2][
  5]["Value"]
Out[9]=

Use 12 degree steps:

In[10]:=
ResourceFunction["TrigDataset"]["Sine", "DegreeStep" -> 12][StandardForm]
Out[10]=

Show multiple results simultaneously:

In[11]:=
tandata = ResourceFunction["TrigDataset"][Tan, "DegreeStep" -> Quantity[3/2, "Degree"]];
In[12]:=
tandata[[2 ;; 4]][StandardForm]
Out[12]=

For many "DegreeStep" values, one can obtain a radical result using "Value":

In[13]:=
tandata[1, "Value"]
Out[13]=

Use a Quantity for "DegreeStep" to specify radians:

In[14]:=
ResourceFunction["TrigDataset"][Cos, "DegreeStep" -> Quantity[Pi/15, "Radians"]]
Out[14]=
In[15]:=
ResourceFunction["TrigDataset"][Cos, "DegreeStep" -> Quantity[12, "Degree"]]
Out[15]=

Possible Issues (2) 

Sometimes the result of the closed form appears inside the dataset, which is not very useful for copying the result:

In[16]:=
sin6 = ResourceFunction["TrigDataset"][Sin, "DegreeStep" -> 1/2];
sin6[5, "Value"]
Out[17]=

Retrieve the StandardForm:

In[18]:=
sin6[5, "Value"][StandardForm]
Out[18]=

The smaller the "DegreeStep", the longer the time to evaluate. Tangent with step 1/2 takes about 10 minutes and step 3/8 takes about 20 minutes:

In[19]:=
ResourceFunction["TrigDataset"][Tan, "DegreeStep" -> 1/2]; // Timing
Out[19]=
In[20]:=
ResourceFunction["TrigDataset"][Tan, "DegreeStep" -> 3/8]; // Timing
Out[20]=

Publisher

Claudio Lobo Chaib Filho

Version History

  • 1.0.0 – 26 June 2020

Related Resources

License Information