Simpson's rule says the integral from x_0 to x_2 of f(x)dx is approximately h(1/3 f(x_0) + 4/3 f(x_1) _1/3 f(x_2)) where h = x_2-x_0 and x_1 is the midpoint of x_0 and x_2. Write a function simp(f,a,b,n) which integrates the function f(x) over the interval [a,b] by dividing it into n subintervals.   integrate e^-x over [0,1] to make sure it matches the integral found with scipy.integrate.quad to 5 decimal places

Algebra & Trigonometry with Analytic Geometry
13th Edition
ISBN:9781133382119
Author:Swokowski
Publisher:Swokowski
Chapter3: Functions And Graphs
Section: Chapter Questions
Problem 52RE
icon
Related questions
Question

Python: Simpson's rule says the integral from x_0 to x_2 of f(x)dx is approximately h(1/3 f(x_0) + 4/3 f(x_1) _1/3 f(x_2))

where h = x_2-x_0 and x_1 is the midpoint of x_0 and x_2. Write a function simp(f,a,b,n) which integrates the function f(x) over the interval [a,b] by dividing it into n subintervals.

 

integrate e^-x over [0,1] to make sure it matches the integral found with scipy.integrate.quad to 5 decimal places 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Fundamental Theorem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, advanced-math and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage