0% found this document useful (0 votes)
98 views

Verilog Lecture

The document discusses the construction of the Gaussian 2-point integration rule. It begins by introducing Gaussian integration and how it determines interpolation points (x_i) and weights (w_i) to minimize error for high degree polynomials. It then works through an example where n=1, developing the 4 equations needed to determine the 2 points and 2 weights to achieve exactness for cubic polynomials. The key steps are to first find conditions on the interpolation points x_0 and x_1 to minimize error, and then choose points that satisfy those conditions.

Uploaded by

Ram Janam Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

Verilog Lecture

The document discusses the construction of the Gaussian 2-point integration rule. It begins by introducing Gaussian integration and how it determines interpolation points (x_i) and weights (w_i) to minimize error for high degree polynomials. It then works through an example where n=1, developing the 4 equations needed to determine the 2 points and 2 weights to achieve exactness for cubic polynomials. The key steps are to first find conditions on the interpolation points x_0 and x_1 to minimize error, and then choose points that satisfy those conditions.

Uploaded by

Ram Janam Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Elementary Numerical Analysis

Prof. Rekha P. Kulkarni

Department of Mathematics

Indian Institute of Technology, Bombay

Lecture No. # 12

Gauss 2-point Rule: Construction

Our today’s topic is Gaussian integration. So far, when we considered numerical


integration rules, what we did were, we fixed the interpolation points. So, we started with
interpolation points x 0 x 1 x n.

We fitted an interpolating polynomial and then integration of that interpolating


polynomial that was approximation to integral a to b f x d x. Now today, what we are
going to do is, we will not fix the interpolation points before hand. We will try to write
an interpolation formula of the form, summation w i f x i where w i’s are the bits and x
i’s are the interpolation point.

So, we are going to have, i going from 0 to n. So, in total we have got 2 n plus 2
constants to be determined. Now these we will try to determine, so that, there is no error
for polynomials of degree less than or equal to 2 n plus 1.
(Refer Slide Time: 01:47)

So, that is the idea of gauss integration. So, when we fix points x 0 x 1 x n in the interval
a b and look at p n x to be equal to summation f x i l i x i goes from 0 to n where l i is the
Lagrange polynomial. So, it is product j goes from 0 to n x minus x j divided by x i
minus x j, j not equal to i; this is Lagrange polynomial.

Then integral a to b f x d x is approximately equal to integral a to b p n x d x which will


be equal to summation i goes from 0 n f x i integral a to b l i x d x.

Now, what you have to note is that l i x the Lagrange polynomial, it depends only on the
interpolation points x 0 x 1 x n. So, there is no function f coming in to picture there; it is
a polynomial of degree n.

So, you can integrate. So, you integrate and then you are going to get the weights w i. So,
we have this to be equal to summation i goes from 0 to n f x i w i. So, these are real
numbers independent of our function f. Now this is going to be our starting point.

So, let us start with a formula integral a to b f x d x is approximately equal to summation


w i f x i, i goes from 0 to n.
(Refer Slide Time: 03:57)

So, our starting point is integral a to b f x d x is approximately equal to summation i goes


from 0 to n w i f x i and we want to determine x i’s and w i’s, such that integral a to b f x
d x is equal to summation w i f x i, i goes from 0 to n for polynomials of degree less than
or equal to 2 n plus 1.

So, we want that there should not be any error, if our function f is a polynomial of degree
2 n plus 1. This can be achieved provided there is no error for functions 1 x, x square, up
to x raise to 2 n plus 1 because any polynomial of degree 2 n plus 1 is going to be
combination of this functions 1 x, x square, x raise to 2 n plus 1.

So, now put f x is equal to 1 and then equate an integral a to b 1 d x is equal to


summation w i f x i, i goes from 0 to n. So, f x is 1. So, that will give us one equation and
like that you will have 2 n plus 2 equations because there will be f x is equal to 1 then x,
x square up to x raise to 2 n plus 1 and then our unknowns are also 2 n plus 2 in number;
the unknowns are going to be the weights w 0 w 1 w n and x 0 x 1 x i. So, we have got 2
n plus 2 equations into n plus 2 unknowns.

So, let us look at some special cases. So, suppose we are taking n is equal to 0; that
means, we have got x 0 is 1 point and w 0 is the weight.
We want integral a to b f x d x, is equal to w 0 f x 0 is f is a polynomial of degree 1
which we mean that once take function f x is equal to 1 then take f x is equal to x, you
will get 2 equations and from that we will try to determine w 0 and x 0.

So, let us do that. So, we have integral a to b f x d x is approximately equal to w 0 f x 0,


w 0 x 0 these are unknowns.

f x is equal to 1 constant function; we want that there is no error.

That means integral a to b d x should be exactly equal to w 0 of f x 0.

F of x is 1, so that means, it is equal to w 0.

So, this imposes the condition that w 0 should be equal to b minus a. So, which means
that if I choose w 0 to be equal to b minus a and x 0 to be any point in the interval a b,
then the formula w 0 f x 0 is going to be exact for constant polynomials.

So, now we want our formula to be exact for linear polynomials. So, we will impose one
more condition for f x is equal to x. So, w 0 we have already determined the condition f x
is equal to x that will determine our point x 0.

So, we have f x is equal to x; in this case also no error that will happen, provided integral
a to b x d x is equal to w 0 x 0, which will imply b square minus a square by 2 which is
the integral a to b x d x should be equal to w 0 is b minus a multiplied by x 0.

So, this means x 0 should be equal to midpoint a plus b by two. So thus, integral a to b f
x d x if you approximate it by b minus a into f of a plus b by 2 this is going to be exact
for linear polynomials.

And this is nothing, but the midpoint rule. So thus, we have solved a problem for case n
is equal to 0. Now let us look at the case n is equal to 1.

So, when you put n is equal to 1 you are trying to approximate integral a to b f x d x by a
formula of the type w 0 f x 0 plus w 1 f x 1, unknowns w 0 w 1 x 0 x 1 we will like to
determine in such a manner that now our rule is exact for polynomials of degree less than
or equal to 3.
This will be achieved provided there is no error for 4 functions which are 1 x, x square x
cube any cubic polynomial is going to be of the form a 0.

Plus a 1 x plus a 2 x square plus a 3 x cube. So, if there is no error for the 4 functions 1 x,
x square, x cube there will not be any error for a cubic polynomial a general cubic
polynomial.

(Refer Slide Time: 11:09)

So, let us equate and get the 4 equations. So, we have integral a to b f x d x is
approximately equal to w 0 f x 0 plus w 1 f x 1. First put f x is equal to 1 then we want b
minus a should be equal to w 0 plus w 1.

So, that is the first condition. Then f x is equal to x. So, that is going to be b square
minus a square by 2 it is the integral a to b x d x and on the right hand side it is going to
be w 0 x 0 plus w 1 x 1. Next look at the function f x is equal to x square, its integral is x
cube by 3. So, this is going to be b cube minus a cube by 3, on the right hand side it will
be w 0 x 0 square plus w 1 x 1 square and f x is equal to x cube that will be b raise to 4
minus a raise to 4 divided by 4 is equal to w 0 x 0 cube plus w 1 x 1 cube. So, let me call
these 4 equations 1 2 3 4.

So, we have got 4 equations in 4 unknowns, which are w 0 w 1 x 0 x 1. Now these 4


equations, we got 4 equations in 4 unknowns, but these are non-linear equations if they
were linear equations then solving them is easy, but we have got 4 non-linear equations.
Now, in this particular case one can do some manipulation and one can try to find w 0 w
1 x 0 x 1, but what we want is we want to look at a general case that when you are
considering a formula of the type summation i goes from 0 to n w i f x i.

How I should choose the weights w i’s and the interpolation points x i’s in such a manner
that I have no error for as high degree polynomial as possible.

So, that is why we will not do manipulation for this, but look at a general case. Now for
the general case, the method which we are going to use, I am going to explain again for
this particular case n is equal to 1 and then we will see how to generalize.

So, the first thing we are going to do is, we are going to obtain the conditions on x 0 x 1
which will guarantee that if you interpolate, if you choose x 0 x 1 in a certain manner, fit
a linear polynomial, integrate then the formula which you are going to get it will be exact
for cubic polynomial.

So, let us derive the condition which the interpolation points x 0 and x 1 should satisfy.
Once we find this condition there are going to be 2 conditions; then we will see, how to
choose x 0 and x 1.

So, that these conditions are satisfied. So, first we are finding the conditions which the
interpolation points x 0 and x 1 should satisfy and then find the points x 0 x 1 which
satisfy this condition.

So, let us look at 2 points x 0 and x 1, fit a linear polynomial no matter how you choose
your 2 points x 0 and x 1 if you fit a linear polynomial then the interpolating polynomial
is same as the function if the function is a linear polynomial. So, there will not be any
error in our integration formula for linear polynomials, but we want something more we
want that the error should not be there or error should be equal to 0 for cubic polynomial.
(Refer Slide Time: 16:10)

So, we have f x is equal to f x 0 plus divided difference based on x 0 x 1 in to x minus x


0 and then you have got error term f of x 0 x 1 x multiplied by x minus x 0,x minus x 1.

So, this is our polynomial p 1 x and this is our error and hence integral a to b f x d x will
be equal to integral a to b p 1 x d x plus integral a to b f of x 0 x 1 x x minus x 0 x minus
x 1 d x. So, this is going to be the error in the integration. Now we have used this
technique beforehand. If your points x minus x 0, if your points x 0 and x 1 are such that
integral a to b x minus x 0 x minus x 1 d x is equal to 0.

Then we will like to make use of this relation, in order to manage our error we had done
this for the midpoint rule; in the case of midpoint rule we had integral a to b x minus a
plus b by 2 b x is equal to 0. So, our error formula has got 2 parts; it has got a divided
difference and then you are multiplying by the function w i. So, this divided difference in
the error formula it depends on x. So, we cannot take it out of the integration sign.

But if I replace this divided difference which is based on x by a divided difference which
is independent of x and then plus extra term then I can take the divided difference out.
So, let us look at the error.

And then f of x 0 x 1 x this divided difference, let me write it as f of y 0 x 0 x 1 plus f of


y 0 x 0 x 1 x multiplied by x minus y 0; this is the recurrence relation this you take on the
other side divide by x minus y 0 that is the recurrence formula for f of y 0 x 0 x 1 x.
So, this I am going to substitute here; now here y 0 is a fix point. So, that will come out
of the integration sign and our error will be equal to f of y 0 x 0 x 1 integral a to b w x d
x plus integral a to b f of y 0 x 0 x 1 x multiplied by x minus y 0 w x d x where I am
calling this as w x. So, if this is equal to 0 then our error is going to have this form.

(Refer Slide Time: 20:25)

If integral a to b w x d x is equal to 0 then error is equal to integral a to b divided


difference based on y 0 x 0 x 1 x w x x minus y 0 d x.

So, now look at the error; error has a divided difference based on 4 points that is f of y 0
x 0 x 1 x if your function f is a quadratic polynomial then this divided difference will be
0 and that means, error will be 0. So, if our points x 0 and x 1, if they are such that
integral a to b w x d x is equal to 0 then we get the formula to be exact for quadratic
polynomial. So, earlier we had only exactitude for linear polynomials, now we got for
quadratic polynomial with 1 condition integral a to b w x d x. Now we will use the same
technique again and then obtain another condition which will give us the error to be 0 for
cubic polynomials.

So, now let us write down the divided difference y 0 x 0 x 1 x has f of y 1 y 0 x 0 x 1


minus f of y 1 y 0 x 0 x 1 x multiplied by x minus y 1. So, this is the recurrence relation;
this we substitute in the error. So, we will get error to be equal to f of y 1 y 0 x 0 x 1
integral a to b w x, x minus y 0 d x plus, here it should be plus not minus, plus integral a
to b f of y 1 y 0 x 0 x 1 x, x minus y 1 then we have got this w x y 0. So, it will be x
minus y 0 w x d x.

Now, if this is equal to 0 then this will be the expression for the error. If integral a to b w
x d x is 0 and integral a to b w x multiplied by x minus y 0 is equal to 0. If both the
conditions are satisfied our error is integral a to b divided difference based on 5 points
the points are the divided difference is based on y 1 y 0 x 0 x 1 and x. So, we have got 5
points.

If f is a polynomial of degree 3 then this divided difference will be equal to 0. So, our
error is integral a to b, a divided difference multiplied by w x into x minus y 0 x minus y
1 d x if the divided difference term is 0 error is going to be equal to 0.

So, thus we obtain 2 conditions, which guarantee that there is no error for cubic
polynomials and those 2 conditions are integral a to b w x d x is equal to 0 and integral a
to b w x into x minus y 0 d x is equal to 0.

(Refer Slide Time: 25:03)

We have w x is x minus x 0 x minus x 1 integral a to b w x d x is equal to 0 integral a to


b w x, x minus y 0 d x is equal to 0 implies that the error is integral a to b f y 1 y 0 x 0 x
1 x multiplied by w x into x minus y 0 x minus y 1 d x and this term is equal to 0 if f is a
cubic polynomial.
So, this means error is equal to 0 if f is a polynomial of degree, less than or equal to 3.
Now, look at the condition integral a to b w x x minus y 0 d x y 0 is a fixed point and we
already have integral a to b w x d x is equal to 0.

So that means, this condition will reduce to integral a to b w x x d x is equal to 0. So, the
conditions which we get are integral a to b w x d x should be equal to 0 and integral a to
b w x multiplied by x d x is equal to 0.

So, we have to choose x 0 and x 1 such that these 2 conditions are satisfied and then for
the error our y 0 and y 1 they can be any points in the interval a b. So, we can choose our
y 0 to be equal to x 0 y 1 is equal to x 1 and we will get integral a to b f of x 0 repeated
twice x 1 repeated twice x x minus x 0 square x minus x 1 square d x.

Now, the reason for writing in this manner will be; now we have got a divided difference
which is going to be continuous provided your function f is sufficiently differentiable,
your multiplying by a function x minus x 0 square x minus x 1 square. So, this function
is always bigger than or equal to 0. So, we can apply mean value theorem for integrals
and then the divided difference we can take it out as divided difference based on x 0
repeated twice x 1 repeated twice and some point c, multiplied by integral a to b x minus
x 0 square x minus x 1 square d x.

We can integrate this and then obtain a more precise bound as compare to, if we had
dominated the x minus x 0 and x minus x 1 by b minus a. So, now, our problem is we
have reduced our problem to finding x 0 and x 1 such that x minus x 0 x minus x 1 its
integral is 0 and if you multiply x minus x 0 x minus x 1 by x.

Then that integral also should be 0 now as I said we want to have a general method; that
means, here we have taken only n is equal to 1. So, we have got 2 interpolation points x
0 and x 1, but whatever we want to do we want to do it that, you should be able to extend
it for the more general case like when you have got n plus 1 points then how I should
choose my n plus 1 points

So, that we have got exactitude for polynomials of degree less than or equal to 2 n plus 1.
So, in order to do that what we are going to do is we are going to recall what is the inner
product. So, on our space c and d it is the vector space of continuous real valued
functions defined on interval a b, on this we will define a inner product as integral a to b
f x into g x d x once we have inner product we can talk of 2 functions being
perpendicular.

So, if the inner product is equal to 0 we say that f is perpendicular to g look at our
condition which we want; it is integral a to b x minus x 0 x minus x 1 d x should be equal
to 0; that means, we want our function w x to be perpendicular to the constant function 1
and second condition tells us that our w x should be perpendicular to the function f 1 x is
equal to x.

So, we will start with 3 functions function constant 1 then x and then x square to this we
will apply gram-Schmidt orthonarmalisation process and get a quadratic polynomial
which is perpendicular to constant function 1 and function x; this quadratic polynomial,
look at the roots of this, if the roots are x 0 and x 1 those are going to be our desired
point and what we will do is inner product we will defined on c a b, but in order to find
the points x 0 and x 1.

We will first consider the interval minus 1 to 1 and then we will look at a map from
minus 1 to 1 to the interval a b which is 1 to 1 on to n a fine and using this map we will
transfer the results to interval a b. So, let us look at the inner product on c a b.

(Refer Slide Time: 32:04)


So, the vector space is c a b, f and g these are functions in c a b inner product f comma g
is integral a to b f x into g x into d x.

So, this is inner product; its properties are inner product of f with itself is going to be
bigger than or equal to 0 because we will be looking at integral a to b f square x d x f is a
real valued function then f comma f is equal to 0 if and only if the function f x is
identically 0

If the function is identically 0 then integral a to b f square x d x will be 0; on the other


hand if integral a to b f square x d x is 0. So, integral a to b f square x d x is equal to 0
then f square is continuous f square x is bigger than or equal to 0 and which will imply
that f x has to be identically 0.

So, this is the first property. Second property is inner product of f with g it is same as
inner product of g with f and that is because our multiplication of real numbers is
commutative and third property which is known as linearity, f 1 plus f 2 its inner product
with g will be inner product of f 2 with g plus inner product of f 2 with g and alpha times
f comma g will be alpha times f comma g where alpha is a real number.

F 1 and f 2 these are continuous function.

So, these are the properties of inner product. So, we have defined the inner product and
now we are going to look at the 3 functions

(Refer Slide Time: 34:44)


f 0 x is equal to 1, f 1 x is equal to x, f 2 x is equal to x square, look at g 0 x this will be
equal to we define it has f 0 x divided by inner product of f 0 with itself and raise to half
we have got an induced norm; if you define norm of f to be square root of inner product
of f with itself.

This is going to be bigger than or equal to 0. So, it is going to be greater than or equal to
0 we can take its positive square root and this is generally denoted by norm f 2.

So, this has properties that norm f 2 is bigger than or equal to 0 it is equal to 0 if and only
if f x is identically 0. Second, norm of alpha f will be equal to mode alpha times norm f
where alpha belongs to r and the third one is norm of f plus g is less than or equal to
norm f plus norm g, this is known as triangle inequality and triangle inequality is proved
using Cauchy Schwarz inequality, which is modulus of inner product of f with g that is
less than or equal to norm f into norm g.

So, we have, look at the 3 functions 1 x x square from this we want to construct 3 other
functions which I will denote by g 0 g 1 g 2 which will have property that if you look at
the norm of each function, it is going to be equal to 1 and if you consider any 2 distinct
functions like if you consider g 0 and g 1 its inner product will be 0, inner product of g 0
with g 2 will be 0 and inner product of g 1 with g 2 is equal to 0.

So this, the way we are going to do that is known as gram Schmidt orthonormalization
process, we will do it for the 3 functions, but then one can define it for n functions.
(Refer Slide Time: 37:59)

So, we have our f 0 x is equal to 1, f 1 x is equal to x, f 2 x is equal to x square define g


0 x to be equal to f 0 upon norm f 0 2 norm.

So, which will imply the f 0 x, which will imply that norm g 0 2 norm is going to be
equal to 1. Next look at r 1 x to be equal to f 1 x minus inner product of 1 with g 0
multiplied by g 0. So, this is my definition; if I look at inner product of r 1 with g 0, it is
going to be inner product of f 1 minus inner product of f 1 with g 0 g 0 and then g 0.

Now, we use linearity of inner product to write this as inner product of f 1 with g 0
minus this is going to be a scalar. So, it will come out of the inner product. So, it will be f
1 g 0 and what is left is inner product of g 0 with g 0; now our norm g 0 2 is positive
square root of inner product of g 0 with itself.

So, this is going to be equal to 1 and then this will get cancelled. So, you will get r 1 g 0
to be equal to 0, now when you look at r 1 we have got f 1 x is equal to x, this is going to
be some scalar g 0 x is going to be multiple of 1. So, this is going to be a linear
polynomial

So, by vary construction our r 1 is perpendicular to g 0 and now if I want r 1 to have


norm 1, define g 1 to be equal to r 1 upon norm r 1. So, we will have norm g 0 to be
equal to 1 norm g 1 to be equal to 1 and inner product of g 0 with g 1 is equal to 0.
So, now we will look at the function x square, we have got g 0 to be a constant
polynomial g 1 to be a polynomial of degree 1 which is perpendicular to each other.

F 2 x is our function x square. So, from this function we will sort of subtract the
component of our f 2 in the direction of g 0 and in the direction of g 1.

So, we will construct our r 2 in such a manner that r 2 is perpendicular to both g 0 and g
1 our r 2 is going to be a quadratic polynomial which will be perpendicular to g 0 and g 1

(Refer Slide Time: 41:53)

Define r 2 x to be equal to f 2 x minus inner product of f 2 with g 0 into g 0 x minus


inner product of f 2 with g 1 into g 1 x.

When you look at inner product of r 2 with g 0 that will be inner product of f 2 with g 0
minus inner product of f 2 with g 0 into inner product of g 0 with itself minus inner
product of f 2 with g 1 and then inner product of g 1 with g 0 using the linearity of inner
product.

This is 1, this is 0. So, this gets cancelled and then you get r 2 comma g 0 to be equal to
0; then you look at inner product of r 2 with g 1 that will be inner product of f 2 with g 1
minus inner product of f 2 with g 0 the coefficient and inner product of g 0 with g 1
minus inner product of f 2 with g 1 and inner product of g 1 with itself.
So, this is going to be equal to 1, this is equal to 0, these 2 will get cancelled and then
you get r 2 comma g 1 is equal to 0. Next define g 2 to be equal to r 2 upon norm r 2. So
this will imply that norm of g 2, 2 norm is going to be equal to 1.

So, this is the procedure for constructing g 0 g 1 g 2, 3 ortho normal functions which we
have obtained from the functions 1 x x square this was the general procedure.

Now, let us look at the interval to be minus 1 to 1 and find explicit expression for g 0 g 1
g 2. So, when you look at the interval minus 1 to 1 our

(Refer Slide Time: 44:27)

f 0 x is equal to 1 x belonging to minus 1 to 1 then norm f 0 will be integral minus 1 to 1


d x raise to half that is going to be equal to root 2 and hence our g 0 x is function 1 by
root 2 it is f 0 upon norm f 0; next r 1 x is f 1 x which is x minus f 1 comma g 0 g 0.

Let us calculate the inner product f 1 comma g 0 that is integral minus 1 to 1 x g 0 is 1 by


root 2 d x. So, this is already equal to 0. So, we have got our r 1 x to be equal to x that
will give us g 1 x to be equal to x divided by norm r 1.

Now, what will be norm r 1? So, norm r 1 2 norm will be integral minus 1 to 1 x square d
x raise to half. So, this is going to be square root of 2 by 3 and that will give us g 1 x to
be root 3 by 2 x and now the third one
(Refer Slide Time: 46:25)

So, let us look at r 2 x. So, r 2 x is going to be equal to x square minus inner product of f
2 with g 0 into g 0 minus inner product of f 2 with g 1 g 1 where our f 2 x is x square, g 0
x is 1 by root 2 and g 1 x is equal to root 3 by 2 x. So, inner product of f 2 with g 0 this
will be integral minus 1 to 1 x square by root 2 d x.

So, this is going to be equal to 2 by 3 root 2 2 by 3. So, this is going to be root 2 by 3


when we look at inner product of f 2 with g 1 this is going to be equal to integral minus
1.

You might also like