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.

6th Jun 2018, 8:23 PM
Mona Mohamed
Mona Mohamed - avatar
6 Antworten
+ 4
Interesting though not a question
6th Jun 2018, 8:30 PM
J.G.
J.G. - avatar
6th Jun 2018, 9:27 PM
Vikas Gola
Vikas Gola - avatar
+ 3
Where k is the term number of the previous term? interesting. I get what you're asking now, I'll try that out.
9th Jun 2018, 11:40 AM
J.G.
J.G. - avatar
+ 2
I want program in C++ to calculate cos(x) using maclaurin series without factorial.
6th Jun 2018, 8:33 PM
Mona Mohamed
Mona Mohamed - avatar
+ 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.
7th Jun 2018, 5:44 PM
Mona Mohamed
Mona Mohamed - avatar
0
k is the term number of the previous term
21st Jun 2018, 4:14 PM
Mona Mohamed
Mona Mohamed - avatar