Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In polynomial _ interpolation. py you will find a function with definition def compute _ piecewise _ errors ( a , b , n _

In polynomial_interpolation. py you will find a function with definition
def compute_piecewise_errors(a,b,n_m, M, n_p, P,f)
The function should return as output:
u_error_matrix, nu_error_matrix - two numpy.ndarrays, each of shape
(n_m,n_p).
u_fig, nu_fig - two matplotlib.figure.Figures.
Complete the function to compute (approximations to) the error
maxxin[a,b]|Spkml(x)-f(x)| for a range of polynomial degrees P={pk}k=0np-1 and
numbers of subintervals M={ml}l=0nm-1. Row l of u_error_matrix should
contain the errors when a uniform set of interpolating nodes is used in each
subinterval, while row l of nu_error_matrix should contain the errors when the
nonuniform set of interpolating nodes is used in each subinterval.
Compute the approximation to the error by evaluating the error |Spkml(x)-f(x)|
for 2500 equally spaced points over a,b and take the maximum of those.
The function should create two plots, one for the uniform errors and one for
the nonuniform errors. Each plot should be of the errors against {ml}l=0nm-1, have
a separate line for each {pk}k=0np-1, and use plt.loglog. The figures should be
returned in u_fig and nu_fig.
Add a description at the top of your compute_piecewise_errors function
as a "docstring" that, when help(p_int.compute_piecewise_errors) is run,
will briefly comment on and explain the results when P={1,2,3,4,5,6} and
M={1,2,4,8,16,32,64,128,256,512,1024}, with
(a)f(x)=sin(x)+110cos(8x),[a,b]=[-1,1].
(b)f(x)=|x-13|2,[a,b]=[-1,1].
You should also comment briefly in the "docstring" on the relative effectiveness
of increasing p and m at reducing the error.
image text in transcribed

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

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

why we face Listening Challenges?

Answered: 1 week ago

Question

what is Listening in Context?

Answered: 1 week ago