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; power = x*x*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

## This note was uploaded on 02/05/2012 for the course CIS 210 taught by Professor Feinstein during the Fall '10 term at S. Alabama.

Ask a homework question - tutors are online