Search for question
Question

Task3: Write a Python program that defines the following functions: 1) A lambda function myfun that takes a number x and returns f(x) = 3x² + 2x. 2) A lambda function analytical_integral that takes two values a and b (b>a), and returns the integral of f(x) from a to b using the analytical formula. f(x) dx = [x³ + x²] = (b³ + b²) - (a¹ + a²). a 3) A function trapezoidal_integral that takes three values a, b (b>a), and n. Return the integral of f(x) from a to b using the Trapezoidal Rule. 11-1 h ["f(x) dx = 2 (f(a) + f(b)) + h [ f(a+hi) i=1 (-a) Where n is the number of subintervals, and h = Hint: this function should call myfun to calculate f(x).

Fig: 1