Worksheet 3: Numerical Integration & Differentiation

advertisement
Selected Topics in Numerical Modelling
I. Numerical Methods & Analysis
Worksheet 3: Numerical Integration & Differentiation
Instructions: Work your way through the following exercises and programming tasks.
Answers should include calculations, MATLAB programs and plots, and should be submitted
by email either as a Word document using Equation Editor, or using LaTeX and PDF.
Answering these questions requires initiative. If you are stuck or something is unclear, ask for
advice, find yourself one or more suitable books in the library and/or bookshop, or consult
with your fellow students. Some of the questions may be indicated as optional; these will only
be included for assessment if they result in a higher mark than you would otherwise get, at the
discretion of the marker, and should only be attempted after you have completed the
compulsory questions.
3.1 Introduction and Background
In this worksheet you are asked to investigate a selection of techniques for numerical
integration and differentiation. The exercises are designed to give you a flavour of the
following two problem areas:
(1) Numerical integration and differentiation of continuous functions (such as polynomial,
exponential and trigonometric functions): In Sections 3.3 and 3.4 you are asked to
investigate methods which are designed to do just this.
(2) Numerical integration and differentiation of tabulated values (e.g., in the form of
experimental data values), where the values are given at a number of discrete points: In
Section 3.2 and 3.4 you are asked to investigate methods specifically designed for this.
Once you are familiar with the basic techniques and how they work, you should proceed with
the exercise in Section 3.5, which asks you to find out about MATLAB's built-in functions to
solve such problems, and how to implement them.
Q 3.1 Define the following terms to a fellow student who is new to this topic:
differentiation; integration; quadrature methods; multiple application/composite
integration formulas; Newton-Cotes integration formulae; open and closed integration
formulas.
Q 3.2 Briefly discuss under what circumstances it would be necessary to resort to numerical
methods for integration.
3.2 Newton-Cotes Formulas for Integration
Q 3.3 In a previous worksheet you were introduced to the problem of a falling parachutist.
You will have shown that the velocity of the parachutist is given by solving the following
equation
 c t 
gm 
m
 1 e

c
where m is the mass of the parachutist and c is the drag coefficient. You are now asked
to determine the distance fallen by the parachutist after a certain time t . Show that this
v(t) 
can be formulated as an integration problem.
For the questions below, you are also given the following information obtained in one
particular jump:
 the distance should be calculated 10 seconds after the jump from an aircraft, starting
from rest;
 the mass of the parachutist is m  71 kg
 the drag coefficient c  12.5 kg/s
08/03/16
1/2
Selected Topics in Numerical Modelling
I. Numerical Methods & Analysis
Q 3.4 Discuss the Trapezium Rule for numerical integration. Your discussion should
include a graphical interpretation, error estimate, limitations, and adaptation for multiple
intervals (including unequal-sized segments).
Q 3.5 Develop a general algorithm for the Trapezium Rule, and program it in MATLAB.
Use your MATLAB program to solve the problem of Q 3.3. Compare with the exact,
analytical solution. What conclusions do you draw from this exercise?
3.3 Integrating Equations & Functions
Q 3.6 Do one or the other version of this question: (Version A - Easier) Discuss briefly
the following techniques for numerical integration, which are expressly designed for cases
where a function is given (as opposed to tabulated information): Gauss Quadrature;
Romberg Integration. Discuss briefly how you would deal with the problem of
determining improper integrals, including ones with infinity as one or both of the
integration limits.(Version B - Harder) Develop a Matlab implementation of Romberg
Integration, explaining the algorithms used.
3.4 Differentiation
Q 3.7 Define the following formulas for first- and second-order derivatives: forward finitedifference; backward finite-difference; centred finite-difference. Choose one of these
formulae and explain how it can be derived, giving the error associated with it. How could
you improve the accuracy of differentiation?
Q 3.8 Experimental data usually contain a significant amount of measurement error. The
following example highlights a serious shortcoming of numerical differentiation. Generate
a vector of smooth, error-free “data” using a function such as y  t 2 in the interval
t : 0  1. Generate a second vector by adding a small amount of "random" error to these
data using Matlab’s built-in random number generator randn. Plot the curves generated
by these two sets of data, as well as the results obtained from numerical differentiation
using one of the schemes discussed in the previous question.
What is the shortcoming referred to? How could you alleviate this problem in practice?
3.5 MATLAB's Built-In Functions
Q 3.9 Explain how you could use MATLAB's built-in functions to
 integrate functions and data;
 differentiate functions and data.
Your explanation should be in the form of brief practical instructions to a fellow
student who has access to MATLAB, but has no knowledge of which functions to
use, and how to use them.
08/03/16
2/2
Download