Composite 3/8 Simpson Method N-1 N-2 3 I(f) Δοξάτο Στ h] fi + 3 Σ fitfiti fi ] + fN+1 i=2,5,8,... i=4,7,10,... +2

Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
icon
Related questions
Question

How would I enter this formula into matlab 

**Composite 3/8 Simpson Method**

The formula for the Composite 3/8 Simpson Method is given by:

\[ 
I(f) \approx \frac{3}{8} h \left[ f_1 + 3 \left( \sum_{i=2,5,8,\ldots}^{N-1} f_i + f_{i+1} \right) + 2 \left( \sum_{i=4,7,10,\ldots}^{N-2} f_i \right) + f_{N+1} \right] 
\]

**Explanation:**

This formula is used for numerical integration, a method of approximating the integral of a function. It is particularly suitable for integration over a range where the function is not easily integrated analytically. The approximation takes into account:

- \( h \) is the width of each subinterval.
- \( f_i \) represents the function evaluated at specific points.
- The terms inside the square brackets \([ \cdots ]\) add contributions from:
  - The first point \( f_1 \)
  - A weighted sum of the function values at points indexed by \( i = 2, 5, 8, \ldots \) using a factor of 3
  - A weighted sum of the function values at points indexed by \( i = 4, 7, 10, \ldots \) using a factor of 2
  - The last point \( f_{N+1} \)

The Composite 3/8 Simpson Method is a higher-order rule compared to the basic Simpson's Rule, using cubic polynomials for better accuracy over each subinterval.
Transcribed Image Text:**Composite 3/8 Simpson Method** The formula for the Composite 3/8 Simpson Method is given by: \[ I(f) \approx \frac{3}{8} h \left[ f_1 + 3 \left( \sum_{i=2,5,8,\ldots}^{N-1} f_i + f_{i+1} \right) + 2 \left( \sum_{i=4,7,10,\ldots}^{N-2} f_i \right) + f_{N+1} \right] \] **Explanation:** This formula is used for numerical integration, a method of approximating the integral of a function. It is particularly suitable for integration over a range where the function is not easily integrated analytically. The approximation takes into account: - \( h \) is the width of each subinterval. - \( f_i \) represents the function evaluated at specific points. - The terms inside the square brackets \([ \cdots ]\) add contributions from: - The first point \( f_1 \) - A weighted sum of the function values at points indexed by \( i = 2, 5, 8, \ldots \) using a factor of 3 - A weighted sum of the function values at points indexed by \( i = 4, 7, 10, \ldots \) using a factor of 2 - The last point \( f_{N+1} \) The Composite 3/8 Simpson Method is a higher-order rule compared to the basic Simpson's Rule, using cubic polynomials for better accuracy over each subinterval.
Expert Solution
Step 1: 3/8 Simpson method Matlab code

f=@(x)exp(x)./(1+x);                            %Defining the function, for example fx=exx+1 is taken

a= input('Enter lower limit a: ');

b=input('Enter upper limit limit b: ');

n=input('Enter the no of subinterval n: ');

h=(b-a)./n;

if rem(n,3)==0

  fprintf('\n Its a valid n');

else

fprintf('\n Its a invalid n');

n= input('\n Enter n as a multiple of 3');

end

k= 1: 1: n-1;

S=f(a+k.*h);

I=3:3:n-1;

S3= sum(S(I));

S(I)=sum[];

So=sum(S)

%Writing Simpson 3/8 formula

out= (3*H./8).*(f(a)+f(b)+3.*So+2.*S*3);

fprintf('The value of the integration is %f\n', out);

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Basic Technical Mathematics
Basic Technical Mathematics
Advanced Math
ISBN:
9780134437705
Author:
Washington
Publisher:
PEARSON
Topology
Topology
Advanced Math
ISBN:
9780134689517
Author:
Munkres, James R.
Publisher:
Pearson,