Calculation of the sine function using the expansion

# Calculation of the sine function using the expansion - term...

This preview shows page 1. Sign up to view the full content.

Calculation of the sine function using the expansion. #include <iostream> #include <cmath> using namespace std; int main() { double sine1, sine2, power, term, fact, x, delta; int k, sign; delta = 0.0000001; sign = -1; cout << " enter the angle " ; cin >> x; k = 3; fact = 6; sine1 = x;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: term = sign*power; sine2 = sine1 + term/fact; while (fabs((sine1-sine2)/sine1) > delta) { k = k+2; sine1 = sine2; sign = -sign; fact = fact*k*(k -1); power = power*x*x; term = sign*power; sine2 = sine1 + term/fact; } cout << "sin = " << sine1 << endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern