`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
clc
clear all
close all
format long
n=2;
a=-2;
b=2;
while(1)
I=CompSR(a,b,n);
if(abs(I-2*exp(-1)*(exp(2) - 1))<0.5e-10)
break;
end
n=2*n;
end
fprintf('Approximation is %.10f\n',I);
function int=CompSR(a,b,n)
h=(b-a)/n;%step of integration
fa=f(a);%value of function at a
fb=f(b);%value of function at b
ff=0;%initialize ff to 0
for i=2:2:n%traversing on even numbers i
x=(a+(i-1)*h);%accessing even points in the intervals divided
fx=f(x);%value of function at x
ff=ff+4*fx;%add 4*fx to ff
end
for i=3:2:n%traversing on odd numbers i
x=(a+(i-1)*h);%accessing odd points in the intervals divided
fx=f(x);%value of function at x
ff=ff+2*fx;%add 4*fx to ff
end
int=(h/3)*(fa+fb+ff);%finally add first and last points tto all the
sum and divide by 3
end
function y=f(x)
y=exp(x/2);
end
Kindly revert for any queries
Thanks.
4. This question is about using the composite Simpson's Rule to estimate the integral 1 =...
can i get some help with this ? 1. Approximate the following integral, exp(r) using the composite midpoint rule, composite trapezoid rule, and composite Simpeon's method. Each method should invol + l integrand evaluations, k 1: 20. On the same plot, graph the absolute error as a function of n. ve exactly n = 2k 2. Approximate the integral from Question 1 using integral, Matlab's built-in numerical integrator. What is the absolute error? 1. Approximate the following integral, exp(r) using...
Numerical Methods Consider the integral 2 (a) [16 marks] Use the composite Simpson's rule with four intervals to calculate (by hand) approximate value of the integral Calculate the maximum value of the error in your approximation, and compare it with the true error. (b) 19 marks] Determine the number of subintervals n and the step size h so that the composite Simpson's rule for n subintervals can be used to compute the given integral with an accuracy of 5 ×...
2. The following integral 2 dr can be computed exactly (a) Estimate the integral using the composite trapezoidal rule with n = exact value of integral and compute the true percent relative error for this approximation 4. Calculate the (b) How many subintervals would be needed to estimate the integral with the composite trapezoidal rule with an accuracy of 102? (c) Estimate the integral using the composite Simpson's 1/3 rule with n = true percent relative error for this approximation...
(10 marks) Evaluate the integral [*r'e ce-dx; 1. Using Composite Trapezoidal rule with (n=4) 2. Estimate the error for the approximation in (a) 3. Using Composite 1/3 Simpson's Rule (n = 4).
4. Composite Simpson's Rule; 31pts). Find an approximation I* of the integral I = S** 2.22 sin(e) de using the Composite Simpson's Rule with n= 10. Present the results of your calculations in a standard output table of the form k24 (12|4) · YR All calculations are to be carried out in the FPAg.
Write a function which takes inputs x, y and n and integrates using Simpson's rule. Write the code in matlab to determine the value of n and h required to approximate So 1 dx to within 10^-5 and compute the approximation. Use Composite Simpson's rule.
Evaluate the integral integral_0 15^2x dx analytically, using the Trapezoidal Rule (1-segment), and Simpson's 1/3 Rule (1-segment). Then use the Matlab trap() function presented in class to find a solution exact to 4 decimal places. How many segments were required for this accuracy?
Consider the integral 8. eT dx Use Simpson's Rule with n = 6 to estimate the value of the integral. (a) (b) Your friend chose instead to estimate the integral above using the Midpoint Rule with n = 6, Noting that the second derivative: 4x2-4r +3)e z5/2 is an increasing function over the interval [1, 4], determine the maximum possible error in your friend's estimate Consider the integral 8. eT dx Use Simpson's Rule with n = 6 to estimate...
4. Consider using the Simpson's 1/3 rule to estimate the following integral I[cos(x 3)l dx (a) Find the approximate values of 1 when the step size h-: 2 and h 1 , respectively. (b) Find an upper bound of the step size h in order to guarantee that the absolute error (in absolute value) of the estimate is less than 0.001. Hint: 2 sin x cos x = sin (2x). I cos x I " The arguments of all trigonometric...
Paragraph Styles Voce Sraut Simpson's 1/3rd rule is an extension of Trapezoidal rule where the integrand is approximated by a second order polynomial instead of a first order polynomial. For a given function f(x) the integral of f(x) over an interval [a, b] using Simpson's 1/3rd rule is given by: S f(x)dx = odx =“ $(x)+4 ()+2 Ž f(x)+F(*,) a 1=1,3,5.... 1=2,4,6,... Where, n is the number of subintervals and h is the width of each subinterval. Write a complete...