Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help. Write in Python. Integrate a function by the trapezoidal rule 5 points An approximation to the integral of a function f(c) over an interval

Help. Write in Python.image text in transcribed

Integrate a function by the trapezoidal rule 5 points An approximation to the integral of a function f(c) over an interval [a, b] can be found by first approximating f(x) by the straight line that goes through the end points (a, f(a)) and (b, S(b), and then finding the area under the straight line, which is the area of the trapezoid. (2) The resulting formula becomes [ fle) = ;" sta) + F6). Write a function trapezint1( f,a,b) that returns this approximation to the integral. The argument f is a Python implementation f(x) of the mathematical function f(c). For instance, the result of trapezint1( math.sin,0,0.5* math.pi ) should be 0.7854 (with some numerical error). The result of trapezint1( abs, -1,1 ) should be 2.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions