Exercise 1.3 : Approximation of functions The function can be approximated by the series )=1+x+デ++ as long as x<1. We would like to explore how many terms are needed to make the difference between f(x) and this series approximation smaller than a given tolerance. For example, for an error of 1x 10- and x=0 only one term from the series is needed, while for x= 1/2 = 2 1-(1/2) and 1 1 1+えttt son=5 terms is enough for an error of I x 10- and x 1/2 - 1.9375 (a) Write a function void numberofTerms (double x, double error, int n)
Exercise 1.3 : Approximation of functions The function can be approximated by the series )=1+x+デ++ as long as x<1. We would like to explore how many terms are needed to make the difference between f(x) and this series approximation smaller than a given tolerance. For example, for an error of 1x 10- and x=0 only one term from the series is needed, while for x= 1/2 = 2 1-(1/2) and 1 1 1+えttt son=5 terms is enough for an error of I x 10- and x 1/2 - 1.9375 (a) Write a function void numberofTerms (double x, double error, int n)
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.7: Do While Loops
Problem 6E: (Numerical analysis) Here’s a challenging problem for those who know a little calculus. The...
Related questions
Question
![Exercise 1.3 : Approximation of functions
The function
(1) =
can be approximated by the series
()~1+x+パ++
as long as x] < 1. We would like to explore how many terms are needed to make the difference between f(x) and this series
approximation smaller than a given tolerance.
For example, for an error of 1x 10- and x=0 only one term from the series is needed, while for x=1/2
= 2
1-(1/2)
and
1.
1.
1+ラt *
- 1.9375
22
so n=5 terms is enough for an error of 1 x 10" and x1/2
(a) Write a function
void numberofTerms (double x, double error, int n)
that will for any value of x less then 1 in magnitude compare the series to the exact function and determine the minimum
number of terms needed to make their difference less than a specified error. Make sure you protect your function
against bad inputs using control structures.
(b) Write a driver program that tests the function numberofTerms written in 1.3(a).](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5e165b7d-f754-456d-add8-a49c4dde5d21%2Fe99af7ec-f039-47e8-85a6-24ca0e863137%2Fiwaj3rj_processed.png&w=3840&q=75)
Transcribed Image Text:Exercise 1.3 : Approximation of functions
The function
(1) =
can be approximated by the series
()~1+x+パ++
as long as x] < 1. We would like to explore how many terms are needed to make the difference between f(x) and this series
approximation smaller than a given tolerance.
For example, for an error of 1x 10- and x=0 only one term from the series is needed, while for x=1/2
= 2
1-(1/2)
and
1.
1.
1+ラt *
- 1.9375
22
so n=5 terms is enough for an error of 1 x 10" and x1/2
(a) Write a function
void numberofTerms (double x, double error, int n)
that will for any value of x less then 1 in magnitude compare the series to the exact function and determine the minimum
number of terms needed to make their difference less than a specified error. Make sure you protect your function
against bad inputs using control structures.
(b) Write a driver program that tests the function numberofTerms written in 1.3(a).
![The report should contain the following sections:
1. list of files: list of each file contained in your submission.
2. usage: This section should explain how to use your program.
3. implementation: this section should provide a brief description of each of your program organization
and its implementation.
4. Bugs: This section should mention any known bugs. If you are unaware of any bugs, simple
place "NONE" under this heading.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5e165b7d-f754-456d-add8-a49c4dde5d21%2Fe99af7ec-f039-47e8-85a6-24ca0e863137%2Fplfrflj_processed.jpeg&w=3840&q=75)
Transcribed Image Text:The report should contain the following sections:
1. list of files: list of each file contained in your submission.
2. usage: This section should explain how to use your program.
3. implementation: this section should provide a brief description of each of your program organization
and its implementation.
4. Bugs: This section should mention any known bugs. If you are unaware of any bugs, simple
place "NONE" under this heading.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr