Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The value of sin(x) can be approximated as: Sin(x) = x - x^3/3! + x^5/5! - x^7/7! ... The expression becomes more accurate when more

The value of sin(x) can be approximated as:

Sin(x) = x - x^3/3! + x^5/5! - x^7/7! ...

The expression becomes more accurate when more terms are added. At some point, however, the soulution is "close enough for engineering purposes."

Create a C++ program called my_sin, using a midpoint break loop to approximate the value of sin(x). Determine convergence by comparing successive values of the summation as you add additional terms. These successive sums should be within an absolute value of 0.001 of each other.

The convergence criterion, epsilon ( * symbol looks like a backwards 3) is met when:

|sin(x)n - sin(x)n - 1| <= epsilon

where "n" is the number of terms:

Test your function by evaluating the my_sin(2 radians) and comparing it to the built-in C++ sine.

Have the program output:

1. The value of sin(2) using your code

2. The value of sin(2) using the C++ sine function

3. The number of terms needed in your summation to reach the conclusion

Note: The factorial function (!) is not included in the C++ library of functions. You must write it yourself in a user-defined function, which may be a value-returning function or a void function.

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

2. (1 point) Given AABC, tan A b b

Answered: 1 week ago