User:Egm6341.s11.team4.kurth/hw2

=Problem 2.3= Refer to lecture slide [[media:nm1.s11.mtg7.djvu|7-2]] for problem statement.

Given

 * $$f(x)=\frac{e^{x}-1}{x}$$

Objectives
To examine the Taylor series expansions of both $$\displaystyle e^x$$ and $$\displaystyle f(x)$$ and their remainders to verify that:


 * $$R_{n+1}[f(x);x] = \frac{(x-0)^{n+1}}{x(n+1)!}e^\xi = \frac{R_{n}[e^{x};x]}{n+1}$$

Solution
For this problem we will examine Taylor series expansions about the point $$ x_0 = 0$$.

In general, functions for which the (n+1)th derivative exists and is continuous, can be expressed in the form

where $$p_{n}(x)$$ is a polynomial of order n and $$R_{n+1}(x)$$ is the corresponding remainder.

During lecture 3, it was shown that these polynomials and remainders take a specific form for Taylor series expansions.

Equation 3 from lecture slide [[media:nm1.s11.mtg3.djvu|3-3]]:

where $$\displaystyle f^{(n)}(x_0)$$ denotes the n-th derivative of f evaluated at $$\displaystyle x_0$$.

Equation 5 from lecture slide [[media:nm1.s11.mtg3.djvu|3-3]]:

For the Taylor series expansion of $$\displaystyle e^x$$ about $$\displaystyle x_0=0$$, all derivatives of $$\displaystyle e^x$$ are also $$\displaystyle e^x$$ and are simplified to 1 when evaluated at $$\displaystyle x_0=0$$.

The result of (3.4) will be manipulated to solve for the expansion and remainder of $$\displaystyle f(x)$$:

(3.8) verifies equation 2 from lecture slide [[media:nm1.s11.mtg6.djvu|6-5]]. Comparing (3.5) and (3.8), it is obvious that the remainders of $$e^x$$ and $$f(x)$$ are similar. If the Taylor series expansion for $$e^x$$ were expanded to (n-1) terms rather than n, then the remainders of both $$e^x$$ and $$f(x)$$ would be of the same degree.

(3.10) confirms equation 1 from lecture slide [[media:nm1.s11.mtg7.djvu|7-1]]!

Solved by William Kurth.

=Problem 2.4= Refer to lecture slide [[media:nm1.s11.mtg7.djvu|7-3]] for problem statement.

Objectives
Plot f(x). Then, integrate f(x) using the following methods:
 * (1) Taylor series expansion
 * (2) Composite trapezoidal rule
 * (3) Composite Simpson rule
 * (4) Gauss-Legendre quadrature

for $$n=2,4,8...$$, until the error reaches the order $$10^{-6}$$.

Solution
The following MATLAB code was used to plot f(x) from -1 to 1.



(1) Integration by Taylor Series Expansion

To evaluate (4.1) by Taylor series expansion, the function f(x) will be approximated by an expansion about the point $$\displaystyle x_0 = 0$$. In homework problem 1.2, this expansion was shown to be

To solve for n, we must first examine the nature of the error.

On lecture slide [[media:nm1.s11.mtg7.djvu|7-1]], this error was shown to have the form that follows (adjusted for different interval):

When observing $$\displaystyle e^{\xi(\alpha)}$$ over the interval $$\displaystyle\alpha\;\in\;[-1,1]$$ it is seen that the function is bounded on both the top and bottom by

This can be extended to say that the error, $$\displaystyle E_n(f)$$, is also bounded as follows:

Now we will calculate the integration of f(x) and the upper bound of the error for increasing values of n until the error reaches the order of $$10^{-6}$$. The following table shows these values.

(2) Integration by Composite Trapezoidal Rule

Equation (1) from lecture slide [[media:nm1.s11.mtg7.djvu|7-4]]:

where $$\displaystyle h=\frac{b-a}{n}$$ and  $$\displaystyle f_n=f(x_n)$$.

The error associated with the composite trapezoidal rule is (Atkinson, p.253)

For this problem (4.10) becomes

Values of In and En are calculated from equations (4.9) and (4.13), respectively, for increasing values of n and shown in the table below.

(3) Integration by Composite Simpson Rule

Equation (4) from lecture slide [[media:nm1.s11.mtg7.djvu|7-4]]:

where $$\displaystyle h=\frac{b-a}{n}$$ and  $$\displaystyle f_n=f(x_n)$$ and n must be even.

The error associated with the composite trapezoidal rule is (Atkinson, p.257)

For this problem (4.15) becomes

Values of In and En are calculated from equations (4.14) and (4.18), respectively, for increasing values of n and shown in the table below.

(4)Integration by Gauss-Legendre Quadrature

Equation (1) from lecture slide [[media:nm1.s11.mtg7.djvu|7-5]]:

where $$\displaystyle \{x_i, i=1,2,3,...,n\}$$ are roots of the Legendre polynomial of order n, $$\displaystyle \mathcal{P}_n(x)$$, and $$\displaystyle w_i$$ are their corresponding weights. Some of these values are shown in the table below supplied in lecture slide [[media:nm1.s11.mtg7.djvu|7-5]].

The error associated with using this method for approximating the value of an integral is given by equation (3) on lecture slide [[media:nm1.s11.mtg8.djvu|8-2]].

Equations (4.19) and (4.20) were solved for increasing values of n until the error reached the order of 10-6 and shown in the table below.

Solved by William Kurth.

=Problem 2.14: Transformation of Variables= Refer to slide [[media:nm1.s11.mtg11.djvu|11-2]] for the problem statement.

Objective
Give details of how to obtain (14.1)

Solution
Let $$\displaystyle x=x(y)$$ be a function of y that satisfies (14.1). To satisfy the boundary conditions x(y) must satisfy the following conditions:

The solution to these conditions lies upon a line passing through the two ordered pairs.

Taking the partial derivative of each side yields an expression for dx:

Plugging these expression back into the middle term of (14.1) yields

Now, let

Combining equations (14.6) and (14.7) proves (14.1):


 * {| style="width:70%" border="0" align="center"

$$\displaystyle \therefore I(f) = \int_{a}^{b}f(x)dx = \int_{-1}^{1}\bar{f}(y)dy $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }
 * }

Solved by William Kurth and Brendan Mahon.