Question: Python coding question This question is a variant of an earlier question in this version you are not allowed to use any for or while

This question is a variant of an earlier question in this version you are not allowed to use any for or while os, nor any list comprehension instead you are expected to make use of the power of sumpy arrays. Write a function trapez_integrator alpha, bet start, and trap that uses the Trapezlum Role to evaluate the integral Card where start and are the limits of integration and in the formula above, and numerapu is the number of trapeziums that the integration interval should be divided into Notes You may nome = 1. If you have trapeziums, the width of each trapezium will be (b-a)/. As stated at the beginning, you are not allowed to use any for or while loops, nor any list comprehensions. Instead you are expected to make use of the power of numpy arrays. Hints: You should expand the expression for the approximate integral to express it as a sum of trapezium heights multiplied by Ar. The end points need special handling. It takes 1 + 1 points to define i trapeziums. Hints: You should expand the expression for the approximate integral to express it as a sum of trapezium heights multiplied by Ar. The end points need special handling. It takes 1 + 1 points to define " trapeziums. For example: Test Result 9.500000 # A simple case with only 3 trapeziums. # You may want to draw what you are computing on paper. area = trapezium_integrator(1.0, 2.0, 0.0, 3.0, 3) print (f"{area:.6f}") # Another simple case with a straight line. area = trapezium_integrator(0.5, 1.0, 2.0, 4.0, 2) print("{area:.6f}") ans = trapezium_integrator(1.0, 2.0, 0.0, 1.0, 9999) print("{ans:.6f}") 3.000000 0.333333
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
