Here\'s what I have so far. The For or While loop seems broken and I dont know h
ID: 3668076 • Letter: H
Question
Here's what I have so far. The For or While loop seems broken and I dont know how to fix it. It just gives me the initialized value back.
Desired Output vs. My Output:
The cosine of x can be expressed in series as 8 cos(x) (2k)! 24 40320 Write a C code that will compute cos(r) based on its series representation, and compare it against the result returned by the built-in cosine function. The series computations should terminate when the absolute error between the series value and the built-in value falls below 10-8. Your code should produce a table similar to the one shown below, for angles descending from 180 degrees to 0 in steps of 5 degrees. Submit your code and the output pageExplanation / Answer
In this question you are taking factorial correctly. Also, the terms are in correctly computed. First of define a fucntion factorial.
***********************************************************8
return fact;
}
**************************************************
going inside while loop:
k = 0
while (error > 10^(-8)){
term = (pow(-1,k)*pow(x,2*k))/factorial(2*k);
series = series + term;
..... rest remains same.
}