WRITE A C++ PROGRAM TO IMPLEMENT THE MID POINT RULE NUMERICAL APPROXIMATION

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 4PP
icon
Related questions
Question

WRITE A C++ PROGRAM TO IMPLEMENT THE MID POINT RULE NUMERICAL APPROXIMATION 

Midpoint Rule
If we consider the case where x is chosen to be the midpoint ; of the subinterval [x;-1, x;]. Then we
have
ь — а
| f(x) dx = M,n = Ax[f(F1)+ f (T2) + + · · · + f(Tm)], where Ax
and õi
(Xi-1+ xi)
•.
n
As shown in the figure below
y A
(c) Midpoint approximation
The following algorithm uses the Midpoint Rule on n subintervals to approximate I
dx:
• INPUT endpoints a, b; positive integer n.
• OUTPUT approximate solution XI to I.
- a
• Step 1 Set h
• Step 2 Set XI = 0; Xbar
= a + 5:
- Step 3 For i = 1,2,-
- Step 4 Set XI = XI+ f(Xbar)
Step 5 Set i = i +1
...n do Steps 4 to 6.
Step 6 Set Xbar = Xbar +h
-
• Step 7 XI = XI * h.
• Step 8 OUTPUT(XI) and STOP.
Transcribed Image Text:Midpoint Rule If we consider the case where x is chosen to be the midpoint ; of the subinterval [x;-1, x;]. Then we have ь — а | f(x) dx = M,n = Ax[f(F1)+ f (T2) + + · · · + f(Tm)], where Ax and õi (Xi-1+ xi) •. n As shown in the figure below y A (c) Midpoint approximation The following algorithm uses the Midpoint Rule on n subintervals to approximate I dx: • INPUT endpoints a, b; positive integer n. • OUTPUT approximate solution XI to I. - a • Step 1 Set h • Step 2 Set XI = 0; Xbar = a + 5: - Step 3 For i = 1,2,- - Step 4 Set XI = XI+ f(Xbar) Step 5 Set i = i +1 ...n do Steps 4 to 6. Step 6 Set Xbar = Xbar +h - • Step 7 XI = XI * h. • Step 8 OUTPUT(XI) and STOP.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Algebraic Expressions
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr