| | |
how to Calculate Sin(x)
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
http://mathworld.wolfram.com/MaclaurinSeries.html
Can you write either "raise to power" or "factorial" recursively?
Can you write either "raise to power" or "factorial" recursively?
It's hard to understand your problem then. If you know how to compute a Maclaurin series by hand, out to the point where the error is less than some tolerance level, why can't you write it in a program?
Of course, that's the whole point of this programming exercise, to convert the ability to do algorithms by hand to the ability to write computer programs that can perform the same algorithms.
You've got sin(x) = x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)! + ..., and there's some formula that tells you the error as well, when you've calculated to N terms.
Use a while loop, or a for loop, and calculate as many terms as you need.
Of course, that's the whole point of this programming exercise, to convert the ability to do algorithms by hand to the ability to write computer programs that can perform the same algorithms.
You've got sin(x) = x - x^3/3! + x^5/5! - ... + (-1)^n*x^(2n+1)/(2n+1)! + ..., and there's some formula that tells you the error as well, when you've calculated to N terms.
Use a while loop, or a for loop, and calculate as many terms as you need.
All my posts may be redistributed under the GNU Free Documentation License.
![]() |
Similar Threads
- calculate the grades for a student using if..else statements. (Java)
- Factorial Calculate (VB.NET)
- Draw sin curve w/ user input, how to code sin()? (C)
- calculate image property in javascript (JavaScript / DHTML / AJAX)
- summations and combinations (C++)
- Calculate the factorial of a number (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: SIP Gateway
- Next Thread: Integrating MSDN Library for VS 2005 into Visual C++ 2005 Express Edition
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






