In mathematics, the sine is a trigonometric function of an angle. The sine of an acute angle is defined in the context of a right triangle: for the specified angle, it is the ratio of the length of the side that is opposite that angle to the length of the longest side of the triangle (the hypotenuse).
More generally, the definition of sine (and other trigonometric functions) can be extended to any real value in terms of the length of a certain line segment in a unit circle. More modern definitions express the sine as an infinite series or as the solution of certain differential equations, allowing their extension to arbitrary positive and negative values and even to complex numbers.
The sine function is commonly used to model periodic phenomena such as sound and light waves, the position and velocity of harmonic oscillators, sunlight intensity and day length, and average temperature variations throughout the year.
The function sine can be traced to the jyā and koṭi-jyā functions used in Gupta period Indian astronomy (Aryabhatiya, Surya Siddhanta), via translation from Sanskrit to Arabic and then from Arabic to Latin. The word “sine” (Latin “sinus”) comes from a Latin mistranslation of the Arabic jiba, which is a transliteration of the Sanskrit word for half the chord, jya-ardha.
Right-angled Triangle Definition
To define the sine function of an acute angle α, start with a right triangle that contains an angle of measure α; in the accompanying figure, angle A in triangle ABC is the angle of interest. The three sides of the triangle are named as follows:
- The opposite side is the side opposite to the angle of interest, in this case, side a.
- The hypotenuse is the side opposite the right angle, in this case, side h. The hypotenuse is always the longest side of a right-angled triangle.
- The adjacent side is the remaining side, in this case, side b. It forms a side of (is adjacent to) both the angle of interest (angle A) and the right angle.
Once such a triangle is chosen, the sine of the angle is equal to the length of the opposite side divided by the length of the hypotenuse, or:
SIN(α) = opposite / hypotenuse
The other trigonometric functions of the angle can be defined similarly; for example, the cosine of the angle is the ratio between the adjacent side and the hypotenuse, while the tangent gives the ratio between the opposite and adjacent sides.
SIN in Tableau
In Tableau, the SIN function returns the sine of an angle; specified the angle in radians. For example:
SIN(0)
= 1.0SIN(PI( )/4)
= 0.707106781186548
Worksheets
I use the SIN function a lot when drawing shapes in Tableau; let us start by drawing out a sine curve. Create the following and paste this into Tableau:
x |
0 |
360 |
Once your worksheet is opened with the copied data:
- Right-click on x then select Create, Click on Bins…
- Let the name as x (bin).
- Set Size of bins to 1 and click Ok.
- Create a new Calculated Field called Index with the following
INDEX()
. - Create a new Calculated Field called y with the following
SIN([Index]*PI()/180)
. - Drag x (bin) onto Columns.
- Right click on x (bin) and make sure Show Missing Values is checked.
- Drag y onto Rows.
- Right click on y, go to Compute Using and Select x (bin).
- Change the Mark Type to Line.
You should see something along the following:
Let us have a little more fun and draw a circle using SIN and COS.
- Create a new Calculated Field called x2 with the following
COS([Index]*PI()/180)
. - Drag x (bin) onto the Path Mark.
- Ensure that Showing Missing Value is selected.
- Drag x2 onto Columns.
- Right click on x2, go to Compute Using and Select x (bin).
Now you should see the following:
Sources
- Wikipedia
- Tableau Office Help Documentation
The first example worked but the second did not, I double-checked it a couple of times. I only see a tiny dot where X2=1.
Can you email me the workbook (or post on Tableau Public) so I can a look. admin@tableau.toanhoang.com
First worked Perfect Second Didnt worked? any idea? and why is the Different charts for cos and SIN?
Sin and Cos are just two different functions, but they start at different points on the X-axis.