% disp(sprintf('**** Examples from Chapter 08 ****'));

% disp(sprintf('**** Example 8.1 Newton-Cotes Quadrature *'));
%%% Calculate weights of three-point closed Newton-Cotes quadrate rule by integrals 
% of interpolating Lagrange polynomial. 
% Test the result on f=exp(-x^2) on interval [-1,1].
% Use MatLab quad() function and test your result.
%
% Calculate weights of quadrature rule, for data from Exa. 8.1 using undetermined 
% coefficients. Compare weights obtained. 

% disp(sprintf('**** Example 8.3 Error estimation *'));
%%% Use the known formulas for the Midpoint rule (a single node),
% Trapezoid rule (two nodes on interval border), and
% Simpson's rule (tree nodes: border and centre of interval)
% Estimate error of trapezoid rule, using integral values obtained by midpoint and 
% trapezoid rule. Which rule is more accurate?

% disp(sprintf('**** Example 8.4 Gaussian Quadrature *'));
%%% Implement Gaussian Quadrature on the interval [-1,1] with 2 nodes.
% Nonlinear system should be solved by an iterative method or by Matlab function.
% Use weights and nodes obtained and calculate the approximate integral of 
% f=exp(-x^2) on interval [-1,1].

% disp(sprintf('**** Example 8.5 Change of interval *'));
% Use results obtained in Example 8.4 to calculate the integral of f=exp(-x^2) on 
% the interval [0,2]. See slide 9 in ./notes/l078_chap8.pdf.
% Use MatLab quad() function and test your result.
