//declaring functions double cos_N (double x, int N) double cos_delta(double x,
ID: 1937683 • Letter: #
Question
//declaring functions double cos_N (double x, int N) double cos_delta(double x, double delta ) int factorial (int n ) double power ( double x, int n) # define PI 3.14 // NO < M A T H .h > ALLOWED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! cos_N (double x, int N) //N terms { if ( x> 0) N += x ; return N ; //end of function } cos_delta(double x, double delta ) //What do I do here ?? { } factorial (int n) //function int Factorial = 0 ; for ( n = 0 ; n < =12 ; n++ ) { Factorial * = n ; } return Factorial ; //end of function power ( double x, int n) { x =1 ; for ( n = 1 ; n > 0 ; n = n + 2 ) { x *= ( -n) ; } return x ; } int main () //How do I use fscanf, fprintf, fclose, fopen. They have to be implemented. { } // Please go here, pages 1 -3, for specific instructions: http://ece15.ucsd.edu/Labs/lab3.pdfExplanation / Answer
#include /* Calculates cos(x) by using a Taylor approximation: cos(x) = x^0/(0!) - x^2/(2!) + x^4/(4!) - x^6/(6!) + x^8/(8!) - ... */ int main(void) { int k; // dummy variable k float x, // parameter of cos(x), in radians epsilon; // precision of cos(x) (cos = sumRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.