Question: use C coding only! 2 Approximating tan(x) Given an angle in degrees, we can approximate the tan function as follows (2)4 180(2)3 + 32400(2) 2

 use C coding only! 2 Approximating tan(x) Given an angle in

use C coding only!

2 Approximating tan(x) Given an angle in degrees, we can approximate the tan function as follows (2)4 180(2)3 + 32400(2) 2 - 58320002 tan (x) (2)4 - 180(20)3 + 32400(2)2 + 1458000.x 328050000 Write a C function that implements the above equation. Use the following function prototype: double tan_approx (double x_deg); The above approximation is only valid for a certain range of c. We wish to determine the range of values of z where the approximation is valid. Compare the output of the above function to the output of the function given below //You must include math.h for this function to work double tand (double x_deg) { double pi, y; pi = Pi_value (10); y = tan (x_deg * pi / 180.); return(y); Note: Your program should call the function Pi.value from problem 1 for the calculation of T. Your main code should use the following steps Loop across values of x from -45 to 100 in steps of 1 degree Calculate Y1 = tan approx(x); Calculate Y2 = tand(x); Calculate the error between the two. err = |Y1-Y2|| If err is small (say less than 0.0022) then approximation of tan is valid Report the range of x such that the approximation is a valid approximation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!