If someone gives me an angle of say, 38 degrees, how will I find out the value of the sine function for it value without using actually making a right triangle with 38 degrees and measuring the sides? I know I can use some trigonometric identities to close in on the values but that would be laborious.
I am sure that the algorithms used in calculators and computers won't resort to doing that. Like if I need to find pi, I will use an algorithm like this :
instead of getting a compass and a ruler and drawing circles.
However, I cannot find any such algorithm for a sine function.
Can someone please help me with this?
2. Sine-Cosine Algorithm The SCA algorithm was proposed by Seyedali Mirjalili in 2016. It is a population-based metaheuristic algorithm applied to optimization problems.
A calculator or computer program is not reading off of a list, but is using an algorithm that gives an approximate value for the sine of a given angle. There are several such algorithms that only use the four basic operations (+, −, ×, /) to find the sine, cosine, or tangent of a given angle.
In this tutorial, we take a look at a very recent algorithm: the sine-cosine algorithm or SCA. It is an optimization procedure that belongs to the family of population-based metaheuristic techniques. Within these, it belongs to the math-based algorithms. 2. Sine-Cosine Algorithm The SCA algorithm was proposed by Seyedali Mirjalili in 2016.
In fact, a calculator uses some kind of algorithm based on the basic operations not only to calculate trigonometric values, but also square roots, values of hyperbolic functions and others. The branch of mathematics called numerical methods studies and develops these algorithms.
One of the most common algorithms for this is to take first few terms of Taylor series for sine.
sin x = x - x3/3! + x5/5! - x7/7! + ...,
The more terms you take the better approximation you get. X is in radians here, but you can get radians from degrees quite easily. And then, as you see, only basic operations: +, -, *, / can be used to calculate the sine.
In machines with floating-point coprocessor chips CORDIC algorithm (with a few other modules) is used, as it also can be implemented in hardware.
Improving John's answer:
Create a table of sin(x) for x in different radians from 0 to pi/2.
You can use interpolation as follows: sin(x+dx) = sin(x) + dx*cos(x)
cos(x) = sin(pi/2-x).
Similarly, cos(x+dx) = cos(x) - dx*sin(x).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With