Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 30 & 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 Maclaurin 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 sin 0=0-546 = 120+176*** cos 0=1 - 6 - 12.** Note that the sine series only uses the odd values of n, while the cosine series uses the even values of n the alternating +/- between the terms (the (-1)" 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 n (n!) for each term. Recall that the factorial is defined as n! = n(n-1)(n-2)(n-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(int N) { int factN = 1; if (N != 0 && N != 1) for (int i=N, >1:1) factN = 1: return factN; Write a C program that uses the above function to calculate the sine and cosine values of any angle e. 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 'factorial function defined above accurate to 3 decimal locations Descriptive output statement(s) that print the values of in degrees) and the sine and cosine

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions