0
How to calculate cos(x) using maclaurin series ?
The program is really simple: The user inputs a parameter x (x being an angle in radians) and a float ε, which is the precision of the value of cos(x). Basically, the only thing the program has to do is to calculate this sum: x^0/0! - x^2/2! + x^4/4! - x^6! + x^8/8! - ..., until the terms are smaller than ε, that is, the value for cos(x) it'll be within our range of precision.To solve this, I noticed that I could just multiply the previous term by -x² / (2k(2k - 1)), to get the next term.
6 Respuestas
+ 4
Interesting though not a question
+ 3
Where k is the term number of the previous term? interesting. I get what you're asking now, I'll try that out.
+ 2
I want program in C++ to calculate cos(x) using maclaurin series without factorial.
+ 2
To solve this, I noticed that I could just multiply the previous term by -x² / (2k(2k - 1)), to get the next term, I want the program solved by this way.
0
k is the term number of the previous term