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)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
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).
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.
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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education