Question: Python problem Make a function defined as: def GaussIntegration(fcn, a, b, n=4): Purpose: use the Gauss Integration method to estimate the integral of fcn(x), between
Python problem
Make a function defined as: def GaussIntegration(fcn, a, b, n=4):
Purpose: use the Gauss Integration method to estimate the integral of fcn(x), between the limits of a and b.
fcn: the function we want to integrate
a and b: the lower and upper limits of integration
n: The number of integration points used. The only acceptable values are 2, 3 and 4. If a value other that 2, 3 or 4 is passed, use n = 4.
return value: the estimate of the integral
Write and call a main() function that uses your GaussIntegration function to estimate and print the integral of:
x - 3 * cos(x) , with a = 1, b = 3 and n = 4
x - 3 * cos(x) , with a = 1, b = 3 and n = 5
cos(2x)*x3, with a = 2, b = 3 and n = 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
