1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How was the Sine function programmed? The actual equation?

  1. Jun 4, 2015 #1
    Hi, I understand that Sine (angle) = opposite/Hypothenus is the ratio of the length of 2 sides in the triangle. However something i never understood and REALLY want to understand is. When you type in some angle in degree in a calculator like sin(14,123221) the calculator spits out a ratio that matches that angle with many descimal points. How can the calculator do this so exact and with so many descimal points? I wouldn't believe that people who invented the sine function manually put in all these values into the calculator, so there must be an underlying mathenmatical equation built into the sine function that converts each degree into specific ratio. What is this equation?

    I'd really appreciate some help on this one :)
     
  2. jcsd
  3. Jun 4, 2015 #2

    micromass

    User Avatar
    Staff Emeritus
    Science Advisor
    Education Advisor
    2016 Award

    That would be Taylor's theorem (although I guess there are others): http://en.wikipedia.org/wiki/Taylor_series#List_of_Maclaurin_series_of_some_common_functions

    In our example, given an angle ##\theta##, we can approximate ##\sin(x)## by

    [tex]x - \frac{x^3}{3\cdot 2\cdot 1} + \frac{x^5}{5\cdot 4\cdot 3\cdot 2\cdot 1} - ..... + (-1)^n \frac{x^{2n+1}}{(2n+1)\cdot (2n)\cdot ...\cdot 3\cdot 2\cdot 1}[/tex]

    The higher you take ##n##, the better you will get to ##\sin(x)##. There is even an easy way to point out how much error you are making.

    Edit: The above formula assumes that ##x## is in radians, so you need to transform ##x## from degrees to radians first!
     
  4. Jun 4, 2015 #3

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Evaluating a Taylor series to calculate a trig function like sin (x) is a horribly inefficient way to make this calculation.

    There is a special algorithm which is programmed into most calculators to evaluate trig and hyperbolic functions:

    http://en.wikipedia.org/wiki/CORDIC
     
  5. Jun 4, 2015 #4
    The Taylor series may not converge quickly enough for a low processing speed calculator.
    I believe a calculator uses a CORDIC algorithm. This other Wiki link about CORDIC shows that there are some tables of coefficients that are used as a basis. On a mini computer I used to use in the mid 70s without any math hardware, their trig library used Chebyshev polynomials.
     
  6. Jun 5, 2015 #5
    Many years ago I read the Fortran Technical manual fora UNIVAC1108. The routines implemented reduced the angle to 0-90 and then split to four ranges. Then it used a 5th degree polynomial in the square of the angle, different coefficients in each of the four ranges.
    The function doesn't have to return the sine of the angle, just a value correct to the required number of bits.
     
  7. Jun 5, 2015 #6
    Thank you so much for the reference, I want to learn how to do it. Do any of you know a thr0rough reference manual or something with a bit more detail (easier to read) than wikipedia?
     
  8. Jun 5, 2015 #7

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    Perhaps if you would tell us what you don't understand about the article or the method, we could help clarify it for you.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How was the Sine function programmed? The actual equation?
Loading...