Question: User-Defined Trigonometric Function:s Do not use math.h for this assignment We wish to write a function that calculates cos(e) without using math.h. Instead of using


User-Defined Trigonometric Function:s Do not use math.h for this assignment We wish to write a function that calculates cos(e) without using math.h. Instead of using math.h we will use a Taylor series approximation to calculate cos(). The Taylor series expansion for cosine is _1.ad2 _1.ad4 _1.ad16 _1.ad8 _1.(1d10 6! cos (-rad) = 1 4! 8! 10! Although the true cosine Taylor series has an infinite number of terms, we will terminate the series at the L rad20o term There are four function calls that will be used to complete this assignment. 1. factorial 2. power 3. wrap 4. mv cos You are given factorial, and power. You will need to write the function calls for wrap and my_cos. To understand what wrap does, note that -degree is an angle, so 6-degree-360 degrees represents the same angle. We want to keep the angle used in our calculations between -180 s Q_degree S 180. Thus the wrap function needs to ensure thate_degree is in the range -180 s _degree 180 Also, since the angle used in the Taylor series is in radians, the output of the wrap function is converted to radians To get you started, here are the function calls, along with a few hints on how to proceed The function call for wrap is double wrap(double theta_degrees){ //This function makes sure the angle is between -180 degrees and +180 degrees //The return value is the wrapped angle in radians double const pi = 3.14159265358979; //Your code goes here return(theta_degrees*pi 180.0); //Convert degrees to radians
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
