How can I know the algorithm that MATLAB uses to approximate values of the sine function?
2 views (last 30 days)
Show older comments
Hi, I try to understand and study the algorithms that MATLAB uses to evaluate sin(x). Since sin(.) is a built-in function, in general, I cannot access the source code. Would that be possible to find that source code somewhere else? Thank you
0 Comments
Accepted Answer
Steven Lord
on 25 Jul 2016
1 Comment
James Tursa
on 25 Jul 2016
A related discussion can be found here:
More Answers (1)
John D'Errico
on 25 Jul 2016
Cleve's article is a good one. It discusses range reduction, a tremendously valuable method for special function evaluation. exp, sin, cos, all benefit from that. There are also methods I discuss in the documentation for HPF, where I explain how to get hundreds or thousands of digits for these problems. There are also tricks one can use to minimize the number of divides, useful in environments where a divide costs more time than a multiply.
Another great source of ideas can be found in Hart's book, "Computer Approximations", a superb text that may be difficult to find anymore. And of course, Abramowitz & Stegun is the classic reference for virtually anything in this domain.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!