Question: Please Write it on Python Based on this idea, the following formula can be derived for approximating the integral: 0, . . . , n,

Please Write it on Python Based on this idea, the following formulaPlease Write it on Python

Based on this idea, the following formula can be derived for approximating the integral: 0, . . . , n, are the coordinates of the sides of the trapezoids. The figure where h is the width of the trapezoids, h = (b-an, and xi-a + ih, i above visualizes the idea of the trapezoidal rule Implement this formula in a Python function trapezint( f,a,b,n. You may need to check and see if b > a, otherwise you may need to swap the variables. For instance, the result of trapezint math.sin,0,0.5*math.pi,10) should be 0.9979 (with some numerical error). The result of trapezint( abs,-1,1,10 should be 1.0 (This assignment is based on Langtangen, Exercise 3.11a.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!