You will need to implement several functions and use one makefile to generate an execution file called ComputeSinX, which implements the Taylor series method of computing sine

The process for the algorithm is as follows:

1. Calculate sin of an input number (x) using the math library in C or C++.

2. Calculate the sin of x using the following formula for the first 4 terms (n=1 to 7):

sin(x) = x - (x^3/3!) + (x^5/5!) - (x^7/7!) + ... +/- (x^n/n!)

3. If the absolute difference of the last two results is less than or equal to some preset threshold, then terminate and output the last approximation as the sin of x; otherwise repeat steps 2 and 3 for the next term of series (n=9, n=11 and so on).

List of Functions

ToRadian.c This function calculates an angle value in radian (PI=3.14159265359)

Factorial.c This function calculates the factorial of an input numbers.

SinXApproximation.c: This function calculates the sine approximation iteratively until the difference is below some threshold.

Main.c: The entry point of the entire program, which takes in two arguments, i.e., the input number and the threshold.

Note

For example x=250, the angle value in radian is 4.3633, and sin(4.3633)=-0.9397 which can also be generated by the Taylor formula when n=17 and threshold=0.0001.

More specifically, for this number, the output should be as follows:

Input number is: 250
Threshold is: 0.0001
Angle value in radian is: 4.3633
Sin(4.3633) = -0.9397
Sine approximation = -0.9397
n = 17

After ll the implementation files are done, you will need to create a Makefile to compile all the codes at once and generate the execution file called ComputeSinX.

By typing the command

./ComputeSinX InputNumber Threshold
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.