Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the SECOND QUESTION at the bottom under Romberg Algo in PYTHON CODE PLEASE! use the info above to help. Text View: Recursive trapezoid rule

image text in transcribedAnswer the SECOND QUESTION at the bottom under Romberg Algo in PYTHON CODE PLEASE! use the info above to help.

Text View:

Recursive trapezoid rule

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.

Recursive trapezoid rule from x = 1 to x = 2, with 16 intervals. Compare with Implement the recursive trapezoid rule as described in Section 5.2 of the text, and use it to numerically integrate f(x) = 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+i*h) 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Write down the circumstances in which you led.

Answered: 1 week ago