Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the value of sin(x) can be approximated as: Sin(x)=x-x^3/3!+x^5/5!-x^7/7!+......The expession becomes more accurate when more terms are added. At some point, however, the solution isclose

the value of sin(x) can be approximated as: Sin(x)=x-x^3/3!+x^5/5!-x^7/7!+......The expession becomes more accurate when more terms are added. At some point, however, the solution is"close enough for engineering purposes." create a c++ Program called my_sin, using midpoint break loop to approximate the value of sin(x). Determine convergence by comparing succesive values of the summation as you add additional terms. These succesive sums should be within an absolute value of 0.001 of each other. The convergence criterion,epson is met when: |sin(x).subscrpt(n)-sin(x).subscript(n+1)|<=epson, where "n" is the number of terms. Test your function by evaluating the my_sin(2radians) and comparing it to the built-in c++ sine. Have the program out put: 1) THE VALUE OF SIN(2) USING YOUR CODE. 2) THE VALUE OF SIN(2) USING C++ SINE FUNCTION. 3) THE NUMBER OF TERMS NEEDED IN YOUR SUMMATION TO REACH THE CONCLUTION. **NOTE: THE FACTORIAL FUNCTION IN SNOT INCLUDED IN THE C++ LIBRARY OF FUNCTIONS. YOU MUST WRITE IT YOURSELF IN A USER-DEFINED FUCTION, WHICH MAY BE A VALUE-RETURNING FUNCTION OR A VOID FUNCTUION

i wrote the funtion for factorials below

#include

using namespace std;

void factorial(int n);

int main()

{

int n;

cout << "Input a number to Factorial :";

cin >> n;

factorial(n);

return 0;

}

void factorial(int n)

{

int fact=1;

for (int i=0; i

{

fact*=(n-i);

}

cout <<"The Factorial of " << n << " is " << fact << endl;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago