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.


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. Projects posted are only 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 fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.