Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 Approximating cos() Given an angle in degrees, we an approximate the cos function as follows 32400-4 Write a C function that implements the above

image text in transcribed
2 Approximating cos() Given an angle in degrees, we an approximate the cos function as follows 32400-4 Write a C function that implements the above equation. Use the following fumction prototype double cosapprox (double x.deg) The above approximation is only valid for a certain range of . We wish to determine the range of valus of where the approximation is valid. Compare the output of the above function to the output of the function given below //You must include ath.h for this function to work double cosd (double x deg) double pi,y Pi Pi-value(10); y = cos(x-deg * pi return (y) / 180'); Note: Yur program should call the function Pi.value froma problesn 1 for the calculation of Your main code should use the following steps Loop across values of x from-360 to 360 in steps of 1 degro . Calculate Y1 = cos-vprn(x); Calculate Y2 = coed(x) . Calculate the error between the two, err = |Y1-Y2] If err is small (say less than 0.0022) then approximation of cos valid . Report the range of x such that the approximation is a valid approximation 2 Approximating cos() Given an angle in degrees, we an approximate the cos function as follows 32400-4 Write a C function that implements the above equation. Use the following fumction prototype double cosapprox (double x.deg) The above approximation is only valid for a certain range of . We wish to determine the range of valus of where the approximation is valid. Compare the output of the above function to the output of the function given below //You must include ath.h for this function to work double cosd (double x deg) double pi,y Pi Pi-value(10); y = cos(x-deg * pi return (y) / 180'); Note: Yur program should call the function Pi.value froma problesn 1 for the calculation of Your main code should use the following steps Loop across values of x from-360 to 360 in steps of 1 degro . Calculate Y1 = cos-vprn(x); Calculate Y2 = coed(x) . Calculate the error between the two, err = |Y1-Y2] If err is small (say less than 0.0022) then approximation of cos 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

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

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions