Question: ANSWER USING PYTHON PLEASE! I DID THE TOP HALF JUST NEED THE ROMBERG ALGO Implement the recursive trapezoid rule as described in Section 5.2 of
ANSWER USING PYTHON PLEASE! I DID THE TOP HALF JUST NEED THE ROMBERG ALGO
Implement the recursive trapezoid rule as described in Section 5.2 of the text, and use it to numerically integrate ()=12f(x)=1x2 from =1x=1 to =2x=2, with 16 intervals. Compare with the true value of the integral.
[3]:
f= lambda x : 1 / (x*x)
p=1
q=2
n=16
h=(q-p)
area=0.5*(f(p)+f(q))
for i in range(1,n):
area+=f(p+i*h)
integral=h*area
print(integral)
0.5005691701269964
Romberg Algorithm
Building on your work above, implement the Romberg algorithm and compute (4,4)R(4,4) for the same function ()f(x). Print out the entire table (,)R(m,n) used to do the computation.
Implement the recursive trapezoid rule as described in Section 5.2 of the text, and use it to numerically integrate f(x) = from x = 1 to x = 2, with 16 intervals. Compare with the true value of the integral. f= lambda x: 1 / (x*x) p=1 q=2 n=16 h=(q-p) area=0.5*(f(p)+f(q)) for i in range(1,n): area+=f(p+ixh) integral=h*area print(integral) 0.5005691701269964 Romberg Algorithm Building on your work above, implement the Romberg algorithm and compute R(4,4) for the same function f(x). Print out the entire table R(m, n) used to do the computation. Implement the recursive trapezoid rule as described in Section 5.2 of the text, and use it to numerically integrate f(x) = from x = 1 to x = 2, with 16 intervals. Compare with the true value of the integral. f= lambda x: 1 / (x*x) p=1 q=2 n=16 h=(q-p) area=0.5*(f(p)+f(q)) for i in range(1,n): area+=f(p+ixh) integral=h*area print(integral) 0.5005691701269964 Romberg Algorithm Building on your work above, implement the Romberg algorithm and compute R(4,4) for the same function f(x). Print out the entire table R(m, n) used to do the computation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
