## (Solved) Question 1 (a) Find an exact formula for the cubic polynomial

Question 1 (a) Find an exact formula for the cubic polynomial P3(x) =

x3 + ? ? ? such that

Math 128A, Spring 2016

Problem Set 07

Question 1 (a) Find an exact formula for the cubic polynomial P3 (x) =

x3 + ? ? ? such that

Z 1

P3 (x)q(x)dx = 0

1

(b) Find exact formulas for the three roots x1 , x2 , x3 of the equation

P3 (x) = 0.

(c) Find exact formulas for the integration weights w1 , w2 , w3 such that

Z 1

1

q(x)dx =

3

X

wj q(xj )

j=1

exactly whenever q is a polynomial of degree 5.

(d) Given any real numbers a &lt; b, ?nd exact formulas for points yj 2 [a, b]

and weights uj &gt; 0 such that

Z b

a

q(x)dx =

3

X

uj q(yj )

j=1

whenever q is a polynomial of degree 5.

(e) Explain why each of the three factors in the error estimate

Z b

a

f (x)dx

3

X

uj f (yj ) = C6 f

(6)

(?)

j=1

Z b

a

(y

y1 )2 (y

y2 )2 (y

y3 )2 dy

is inevitable and determine the exact value of the constant C6 .

(f) Use your code from Question 2 to evaluate

E6 =

Z 1

0

(x

x1 )2 (x

x2 )2 (x

x3 )2 dx

to 3-digit accuracy.

Question 2 (a) Write, test and debug an adaptive 3-point Gaussian integration code gadap.m of the form

function [int, abt] = gadap(a, b, f, p, tol)

% a,b: interval endpoints with a &lt; b

% f: function handle f(x, p) to integrate (p for user parameters)

% tol: User-provided tolerance for integral accuracy

% int: Approximation to the integral

% abt: Endpoints and approximations

1

Math 128A, Spring 2016

Problem Set 07

Build a list abt = {[a1 , b1 , t1 ], . . . , [an , bn , tn ]} of n intervals [aj , bj ] and apRb

proximate integrals tj ? ajj f (x)dx, computed with 3-point Gaussian integration. Initialize with n = 1 and [a1 , b1 ] = [a, b]. At each step j = 1, 2, . . .,

subdivide interval j into into left and right half-intervals l and r, and approximate the integrals tl and tr over each half-interval by 3-point Gaussian

|tj

(tl + tr )| &gt; tol max(|tj |, |tl | + |tr |)

add the half-intervals l and r and approximations tl and tr to the list. Otherwise, increment int by tj . Guard against in?nite loops and ?oating-point

issues as you see ?t and brie?y justify your design decisions in comments.

R

(b) Approximate the integral 01 x x dx using your code from (a). Measure

the total number of function evaluations required to obtain 12-digit accuracy.

Plot the accepted intervals. Compare your results with those obtained in the

previous problem set by Romberg integration.

2

Solution details:
STATUS
QUALITY
Approved

This question was answered on: Oct 15, 2019

Solution~000.zip (25.37 KB)

STATUS

QUALITY

Approved

Oct 15, 2019

EXPERT

Tutor

#### YES, THIS IS LEGAL

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

• As a reference for in-depth understanding of the subject.
• As a source of ideas / reasoning for your own research (if properly referenced)
• For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

### Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE. 