Question: please I need just the code with small explaniation for each line in the program. Introduction Ever wonder how your calculator determine the values of
Introduction Ever wonder how your calculator determine the values of such things as trig functions, exponential values, logarithms...etc! You may have used lookup tables in grade school to find the sine and cosine of standard angles, for example: however, what about finding answers for arbitrary values of angles? Some methods of interpolating can be used to calculate a value of an angle between Say 304 & 35. These require the availability of the table and knowledge of interpolation techniques suitable for the calculation, This project will explore other methods that are more direct and allow for calculating the sine and cosine of any angle. The use of series to calculate the value of many functions has been used by mathematicians, scientists, & engineers for a long time. For this assignment we will utilize such series, known as the Maclarin polynomials (a special case of the Taylor series), to determine the values of the sine & cosine of any angle. Although there are closed form equations that can be used to find approximations for the sine & cosine these generally lake the ability to control the precision of the answers, and the percentage of error can be large for different size of angles (very small angles vs. large angles). The Maclaurin series for the sine and cosine are Cos 0=1- cos 81-468- 4 -177 20! Note that . the sine series only uses the odd values of n, while the cosine series uses the even values the alternating between the terms (the factor as the n! increases in size, each term's contribution to the final value of the function gets smaller very important to also note that the angle is in radians The above series require the calculation of a factorial of factorial is defined as (!) for each term. Recall that the n! = n(n-1) -2 -3)...1 We would need to find the factorial on any integer (whole) positive number in order to use the equations. Assignment: The code below defines a function that returns the factorial of N int factorial in NL int factN-1 NOUN 1) for (int I D :-) fact retum tact: Write a C program that uses the above function to calculate the sine and cosine values of any angle The program must include Input statements with appropriate prompt that reads the value of the angle in degrees Calculates the sine & cosine values of by using the actional function defined above accurate to 3 decimal locations Descriptive output statement(s) that print the values of (in degrees) and the site and cosine
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
