
Johhny J.
asked 07/11/20Calculus trapezoidal and simspsons rule using python programming
this question is to be sovled using python programming
For each of the integral given below, do the following using Python Programming
a) plot the graph related to Trapezoidal's rule or Simpson's Rule for number of intervals that have chosen from N = 5 to 20 intervals (choose one only)
b) approximate each of the given integral using both Trapezoidal's rule and Simpson's rule using two different number of intervals for each case
1) ∫_0^2▒〖"(" x^3 "+x + 1 dx" 〗
2)∫_0^1▒〖sin (x^2)" dx" 〗
3)∫_2^4▒〖" " 1/(1+x^3 )〗 " dx"
4)∫_2^6▒〖" " 1/(ln x)〗 " dx"
1 Expert Answer

Patrick B. answered 07/12/20
Math and computer tutor/teacher
1) Trapezoidal: n=10 --> 8.04
n=20 ---> 8.01
Simpsons: n=10 ---> 8
n=20 ---> 8
the exact answer is (1/4)x^4 + (1/2)x^2 + x , x=2
= 4 + 2 + 2 = 8
2) cannot be integrated without special functions
Trapezoidal: n=10 ---> 0.311170811217031
n=20 ---> 0.310493552903314
Simpsons: n=10 ---> 0.310268
n=20 ---> 0.310268
3) the anti-derivative is
[ln(x^2-x+1) - 2 ln |x+1| + sqrt(3) arctan((2x-1)/sqrt(3))]/6+c
integration steps:
a) factors denomaintor via SOAP formula: (x+1)(x^2-x+1)
b) partial fraction decomposition gets you:
(1/3)(1 / x+1) - (1/3) [ (x-2)/(x^2-x+1)]
c) first term integrates to ln|x+1|
d) second term: rewrites x-2 = (1/2)(2x-1) -3/2
e) splits the second integral into these two pieces, the first
can be integrated via subsituteion U=x^2-x+1
f) the second is done by completing of the square: x^2-x+1 = (x-1/2)^2 + 3/4
and then letting u= (2x-1)/sqrt(3)
The exact answer is 0.088141272
Trapezoidal: n=10--> 0.0885962203610578
n=20 --> 0.0882551985818365
Simpsons: n=10 ---> 0.0881415
n=20 ----> 0.0881413
4) cannot be integrated without special functions
Trapezoidal: n=10---> 3.190042579714
n=20 ---> 3.18034139625903
Simpsons: n = 10 ---> 3.17711
n=20 --->3.17706
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Patrick B.
used online calculators for the trapezoidal, simpson's, and the actual integration. Don't have Python, but I can do Java. Don't feel like re-inventing the wheel.07/12/20