Question: Homework For Question 2, you must include a report that contains the output and visualization. Simply take a snapshot and place it in your submission


Homework For Question 2, you must include a report that contains the output and visualization. Simply take a snapshot and place it in your submission pdf for submission is fine. Some short description to your outputs would be appreciated, but not required. Your submission must include: 1. The written part, which you can write on a piece of paper and scan or type in Markdown with LaTex in this notebook. As long as it is readible, any format is fine. 2. The code for the coding assignments. 3. The report/snapshots of the outputs. (3pt) Question 1 (Written) 1) (1.5pt) Give data {(x;, y.)}7 0. Let wn (x) := II; . (x -x;). Show that 2) (1.5pt) Use the result from 1), show the following alternative formula for the Lagrange form Pn(z) = > yiwn (I) Recall: Lagrange form of the interpolation polynomial derived in class is Pr(x) = (x) . yi, 1 0 where C - Cj li(z) = II j Oj/i C - CO C - C1 c- Ci-1 . . . Ci - CO C- C1 Ci - Ci-1 i - Citl C; - In (3pt) Question 2 (Coding) 1) (1.5pt) Let f(x) = 3x2 + et, compute I = S, f(x )dx by Trapezoid rule with the number of intervals n = 2, 4, 8, 16, 32, 64 and 128. The value of the analytical solution is given as I , store the absolute difference between your approximation and I_exact . Print out all the approximation values and plot the absolute difference curve against n. 2) (1.5pt) Do the same with Simpson's rule. In [ ]: import sympy as sp x = sp. symbols ( 'x' ) f = 3*x* *2+sp. exp(x) display (f ) I = sp. integrate(f, (x, 1, 3)) I_exact = I. evalf ( ) print (I_exact) 43. 3672550947286(1pt) Question 3 (Written) In the error estimate for trapezoid rule that we derived during the lecture, we have: Error estimate on each sub-interval: 1 e 1 Ei(f;h) = 5 f" (&)[ (z ) (@ i) de = h* ' (&)- 2 \" 12 Give the intermediate steps for the calculation of this integral. Hint: Use the fact that ;, | = @; + h and u- substitution you learned in calculus. (2pt) Question 4 (Written) 1) (1pt) Consider the function f(x) = sin(z), and the integral I(f) = _,"0" sin(z) dz. What is the minimum number of points to be used in the trapezoid rule to ensure an error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
