HW7_4 We wish to find the result of sin(ex - 2) dx However, this function is difficult to integrate. Hence, instead of calculating ¹6 sin(ex - 2) dx we will estimate its value by computing the integral of the interpolating polynomial fitted through the following data points which are the actual values of f(x) = sin(ex - 2). This is a much easier task as polynomials are easy to integrate and it provides a good estimate if the two functions are look close to each other when plotted (areas under the curves are also similar) X 0 0.4 0.8 1.2 y -0.8415 -0.4866 0.2236 0.9687 1.6 0.1874 Accordingly, carry out the following tasks (all plots are to be produced on the same figure): a) Plot the above data points using discrete point plotting. b) Plot the function f(x) = sin(e* - -2). c) Use polyfit to do polynomial interpolation for the above data. Plot the interpolating polynomial, using polyval. d) At this point, run your code to produce the plotting results. Do f(x) and the interpolating polynomial follow each other closely? Do you believe that our plan will produce a good estimate? Record your opinion with a print statement. e) Integrate the polynomial by hand, then compute the value of the exact integral using PYTHON. Print the final result using print.

Elements Of Electromagnetics
7th Edition
ISBN:9780190698614
Author:Sadiku, Matthew N. O.
Publisher:Sadiku, Matthew N. O.
ChapterMA: Math Assessment
Section: Chapter Questions
Problem 1.1MA
icon
Related questions
Question
HW7_4 We wish to find the result of sin(x - 2) dx
1.6
However, this function is difficult to integrate. Hence, instead of calculating ¹6 sin(ex − 2) dx we will
estimate its value by computing the integral of the interpolating polynomial fitted through the following data
points which are the actual values of f(x) = sin(e* — 2). This is a much easier task as polynomials are easy to
integrate and it provides a good estimate if the two functions are look close to each other when plotted (areas
under the curves are also similar)
X 0
y
0.4
0.8
1.2
-0.8415 -0.4866 | 0.2236 0.9687
1.6
0.1874
Accordingly, carry out the following tasks (all plots are to be produced on the same figure):
a) Plot the above data points using discrete point plotting.
b) Plot the function f(x) = sin(e* — 2).
c) Use polyfit to do polynomial interpolation for the above data. Plot the interpolating polynomial,
using polyval.
d)
At this point, run your code to produce the plotting results. Do f(x) and the interpolating polynomial
follow each other closely? Do you believe that our plan will produce a good estimate? Record your
opinion with a print statement.
e) Integrate the polynomial by hand, then compute the value of the exact integral using PYTHON. Print the
final result using print.
Transcribed Image Text:HW7_4 We wish to find the result of sin(x - 2) dx 1.6 However, this function is difficult to integrate. Hence, instead of calculating ¹6 sin(ex − 2) dx we will estimate its value by computing the integral of the interpolating polynomial fitted through the following data points which are the actual values of f(x) = sin(e* — 2). This is a much easier task as polynomials are easy to integrate and it provides a good estimate if the two functions are look close to each other when plotted (areas under the curves are also similar) X 0 y 0.4 0.8 1.2 -0.8415 -0.4866 | 0.2236 0.9687 1.6 0.1874 Accordingly, carry out the following tasks (all plots are to be produced on the same figure): a) Plot the above data points using discrete point plotting. b) Plot the function f(x) = sin(e* — 2). c) Use polyfit to do polynomial interpolation for the above data. Plot the interpolating polynomial, using polyval. d) At this point, run your code to produce the plotting results. Do f(x) and the interpolating polynomial follow each other closely? Do you believe that our plan will produce a good estimate? Record your opinion with a print statement. e) Integrate the polynomial by hand, then compute the value of the exact integral using PYTHON. Print the final result using print.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Dimensional Analysis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, mechanical-engineering and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Elements Of Electromagnetics
Elements Of Electromagnetics
Mechanical Engineering
ISBN:
9780190698614
Author:
Sadiku, Matthew N. O.
Publisher:
Oxford University Press
Mechanics of Materials (10th Edition)
Mechanics of Materials (10th Edition)
Mechanical Engineering
ISBN:
9780134319650
Author:
Russell C. Hibbeler
Publisher:
PEARSON
Thermodynamics: An Engineering Approach
Thermodynamics: An Engineering Approach
Mechanical Engineering
ISBN:
9781259822674
Author:
Yunus A. Cengel Dr., Michael A. Boles
Publisher:
McGraw-Hill Education
Control Systems Engineering
Control Systems Engineering
Mechanical Engineering
ISBN:
9781118170519
Author:
Norman S. Nise
Publisher:
WILEY
Mechanics of Materials (MindTap Course List)
Mechanics of Materials (MindTap Course List)
Mechanical Engineering
ISBN:
9781337093347
Author:
Barry J. Goodno, James M. Gere
Publisher:
Cengage Learning
Engineering Mechanics: Statics
Engineering Mechanics: Statics
Mechanical Engineering
ISBN:
9781118807330
Author:
James L. Meriam, L. G. Kraige, J. N. Bolton
Publisher:
WILEY