User:Egm6341.s11.team4/HW1

Homework 1 = Problem 1.1: Limits and Taylor Series=

Refer to lecture slide [[media:nm1.s11.mtg3.djvu|3-1]] for the problem statement.

Given

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



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


 * }.
 * }.

Objectives
1. Find the limit of the function as x approaches zero.


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



\lim_{x \rightarrow 0}f(x)=\frac{e^{x}-1}{x} $$
 * $$\displaystyle


 * }.
 * }.

2. Plot the function over the range from zero to one inclusive
 * {| style="width:70%" border="0" align="center"



f(x)=\frac{e^{x}-1}{x},\ x\in[0,1] $$
 * $$\displaystyle




 * }.

Solution
1. Function Limit

Before employing the Taylor series method of evaluating the limit for the function as x approaches zero, we will use the traditional L'Hopital's rule.


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

\lim_{x \rightarrow 0}\frac{e^{x}-1}{x} $$ Now, seeing that both the numerator and the denominator trend towards zero as x approaches zero, we will take the derivatives of both the numerator and the denominator.
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.


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

\lim_{x \rightarrow 0}\frac{e^{x}}{1} $$
 * $$\displaystyle
 * $$\displaystyle

Evaluating the numerator at x equals zero we find
 * }.
 * }.


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

$$\displaystyle \frac{1}{1}=1 $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.

L'Hopital's rule clearly tells us that the limit of the function approaches one. We will now seek a similar answer using the Taylor series expansion method as demonstrated in class.

We will begin with the Taylor series expansion for $$\displaystyle e^x $$ about zero.


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



\begin{align} e^x \approx \sum_{i=0}^n \frac{x^i}{i!} \\ \end{align} $$
 * $$\displaystyle


 * }.
 * }.

This Taylor series expansion to the n-th order can be displayed so simply since $$\displaystyle e^x $$ evaluated at zero is one and every derivative of the function $$\displaystyle e^x $$ is the function itself. As n goes to infinity this function becomes an equality.

Furthermore, we can evaluate the first term in the summation to get


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



\begin{align} e^x \approx 1+\sum_{i=1}^n \frac{x^i}{i!} \\ \end{align} $$
 * $$\displaystyle


 * }.
 * }.

We can algebraically rearrange this equation to get


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



\begin{align} e^x -1 \approx \sum_{i=1}^n \frac{x^i}{i!} \\ \end{align} $$
 * $$\displaystyle


 * }.
 * }.

Now we have the Taylor expansion of our numerator. To find the Taylor series expansion of our original function we simply need to divide both sides of the above equation by x.


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



\begin{align} \frac{e^x -1}{x} \approx \sum_{i=1}^n \frac{x^{i-1}}{i!} \\ \end{align} $$
 * $$\displaystyle


 * }.
 * }.

The left hand side of this equation is our function $$\displaystyle f(x)$$. The right hand side is a Taylor series approximation of the function. For n=$$\infty$$ this can be expressed as


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



\begin{align} \frac{e^x -1}{x} &= \sum_{i=1}^\infty \frac{x^{i-1}}{i!} \\ \end{align} $$
 * $$\displaystyle


 * }.
 * }.

Inspecting the Taylor series approximation we can see that, when evaluated at $$x=0$$, the numerator will be zero for every i except i=1. Mathematically, this can be expressed by pulling out the term i=1 from our summation, leaving the summation from 2 to infinity.


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



\begin{align} \lim_{x \rightarrow 0} \frac{e^x -1}{x} &= \frac{0^{0}}{0!}+\cancelto{0}{\sum_{i=2}^\infty \frac{0^{i-1}}{i!} }
 * $$\displaystyle

\end{align} $$


 * }.
 * }.

This leads us to our final conclusion (Equation 2), consistent with our expectations via L'Hopital's rule, that


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

$$\displaystyle \lim_{x \rightarrow 0} f(x) = \frac{e^x - 1}{x}=1 $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.

2. Function Plot

The function f(x) is then plotted over the span [0,1] to graphically make clear how the function approaches 1 as x approaches 0. Two functions are plotted for this purpose. First, we will plot the function itself. This function, due to a discontinuity, is not evaluated at 0. Next, we will plot our Taylor series approximation using a value of n=30. Though this value is chosen arbitrarily to minimize computational expense, it is shown in problem 2 that this selection is sufficiently large to make the approximation error negligible. The Taylor series expansion, expressing no discontinuities, is evaluated over the entirety of the span [0,1].

Matlab Code:

Plots:





Both the Taylor series approximation and the function itself clearly show that the value of the function as x approaches zero is one.

Solved by Brendan Mahon.

Given
1. $$\displaystyle f(x)=e^x$$

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

Objectives
Find $$\displaystyle p_{x}(x)$$ and $$\displaystyle R_{n+1}(x)$$ of both the given functions at the point $$ x_{0}=0$$.

Solution
According to the Taylor series from the lecture [[media:nm1.s11.mtg3.djvu|Mtg 3]], the Taylor polynomials is as following:

$${{p}_{n}}(x)=f({{x}_{0}})+\frac{(x-{{x}_{0}})}{1!}{{f}^{(1)}}({{x}_{0}})+\frac{2!}{{f}^{(2)}}({{x}_{0}})....+\frac{n!}{{f}^{(n)}}({{x}_{0}})$$

$${{R}_{n+1}}(x)=\frac{1}{n!}\int\limits_^{x}{{{(x-t)}^{n}}{{f}^{(n+1)}}(t)}dt=\frac{(n+1)!}{{f}^{(n+1)}}(\xi )\begin{matrix} , & \xi \in \left[ {{x}_{0}},x \right] \\ \end{matrix}$$

1. $$\displaystyle f(x)=e^x$$

For $$\displaystyle f(x)={{e}^{x}}$$, take the i-th order derivative:

$$\displaystyle  {{f}^{(1)}}(x)={{f}^{(2)}}(x)=...={{f}^{(n)}}(x)={{e}^{x}}$$.

At point $$\displaystyle {{x}_{0}}=0$$,

$$\displaystyle  {{f}^{(1)}}(0)={{f}^{(2)}}(0)=...={{f}^{(n)}}(0)=1$$.

Thus, the n-th order polynomial and residual is:
 * {| style="width:70%" border="0" align="center"

$$\displaystyle {{p}_{n}}(x)=1+\frac{x}{1!}+\frac{2!}+...+\frac{n!} $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.


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

$$\displaystyle {{R}_{n+1}}(x)=\frac{1}{n!}\int\limits_{0}^{x}dt=\frac{(n+1)!}{{e}^{\xi }}\begin{matrix} , & \xi \in \left[ 0,x \right] \\ \end{matrix} $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.

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

For $$\displaystyle {{f}_{2}}\left( x \right)=\frac{{{e}^{x}}-1}{x}$$, based on the result of 1): $$\displaystyle {{f}_{1}}(x)={{p}_{n}}(x)+{{R}_{n+1}}(x)$$ , we obtain:

$$\displaystyle \begin{align} & {{f}_{2}}^ – (x)=\frac{{{f}_{1}}^ – (x)-1}{x} \\ & \begin{matrix} {} & \begin{matrix} {} & =\frac{{{p}_{n}}(x)+{{R}_{n+1}}(x)-1}{x} \\ \end{matrix} \\ \end{matrix} \\ & \begin{matrix} {} & \begin{matrix} {} & = \\ \end{matrix}  \\ \end{matrix}\frac{1+\frac{x}{1!}+\frac{2!}+...+\frac{n!}+\frac{(n+1)!}{{e}^{\xi }}-1}{x} \\ & \begin{matrix} {} & \begin{matrix} {} & = \\ \end{matrix}  \\ \end{matrix}\frac{1}{1!}+\frac{x}{2!}+...+\frac{n!}+\frac{(n+1)!}{{e}^{\xi }} \\ \end{align}$$

Thus, At point $$\displaystyle {{x}_{0}}=0$$ ,the n-th order polynomial and residual for $$\displaystyle {{f}_{2}}\left( x \right)=\frac{{{e}^{x}}-1}{x}$$ is:


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

$$\displaystyle {{p}^{'}}_{n}(x)=\frac{1}{1!}+\frac{x}{2!}+...+\frac{n!} $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.


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

$$\displaystyle {{R}^{'}}_{n+1}(x)=\frac{(n+1)!}{{e}^{\xi }}\begin{matrix} , & \xi \in \left[ 0,x \right] \\ \end{matrix} $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.

Solved by Shenfeng Yang and Hailong Chen.

Given
IMVT: $$\int_{a}^{b}{w(x)f(x)dx} = f(\xi)\int_{a}^{b}{w(x)dx}\,\!$$

Objectives
1. Prove the Integral Mean Value Theorem (IMVT) for the non-negative function $$w(\cdot)$$

2. Prove the IMVT for $$w(x) \neq 0 \,\,\,\, \forall \,x \in [a,b]$$

Solution
1.  $$\int_{a}^{b}{w(x)f(x)dx} = f(\xi)\int_{a}^{b}{w(x)dx}\,\!$$

Where w(x) and f(x) are continuous on [a,b], w(x) is non-negative and &xi; is a point on [a,b].

For the case where w(x) = 0, both integrals = 0 and we are left with 0 = 0

The rest of this proof is for w(x) > 0

Since w(x) > 0, $$\int_{a}^{b}{w(x)dx}  >  0$$

Let $$\,m := min f(x) \,\,\forall x \in [a,b]$$

Let $$\,M := max f(x) \,\,\forall x \in [a,b]$$

It follows that:  $$\,m\,\le  \,f(x) \,\le\, M\,\, \forall x \in [a,b]$$

We now multiply through by w(x) to get $$\,m w(x)\,\le \,f(x) w(x) \,\le\, M w(x)\,\, \forall x \in [a,b]$$

Which leads to: $$\,m \int_{a}^{b}{w(x)dx}\,\le  \, \int_{a}^{b}{f(x)}{w(x)dx}\,\le\, M \int_{a}^{b}{w(x)dx}\,\, \forall x \in [a,b]$$

We can now divide through by $$\int_{a}^{b}{w(x)dx}$$

To get $$\,m \,\le \, \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\int_{a}^{b}{w(x)dx}}\,\le\, M \, \forall x \in [a,b]$$

Since f(x) is continuous, there must be at least one value &xi; on the interval [a,b]; such that $$f(\xi) = \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\int_{a}^{b}{w(x)dx}}$$

Plugging this value into the original statement $$\int_{a}^{b}{w(x)f(x)dx} = f(\xi)\int_{a}^{b}{w(x)dx} = \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\cancel{\int_{a}^{b}{w(x)dx}}}\cancel{\int_{a}^{b}{w(x)dx}}  =  \int_{a}^{b}{w(x)f(x)dx}$$

proves the theorem.

2. The proof for w(x) > 0 is contained in part a. above.

What follows is the proof for the IMVT with w(x) < 0.

$$\int_{a}^{b}{w(x)f(x)dx} = f(\xi)\int_{a}^{b}{w(x)dx}\,\!$$

Where w(x) and f(x) are continuous on [a,b], w(x) < 0 and &xi; is a point on [a,b].

Since w(x) < 0, $$\int_{a}^{b}{w(x)dx}  <  0$$

Let $$\,m := min f(x) \,\,\forall x \in [a,b]$$

Let $$\,M := max f(x) \,\,\forall x \in [a,b]$$

It follows that:  $$\,m\,\le  \,f(x) \,\le\, M\,\, \forall x \in [a,b]$$

We now multiply through by w(x) to get $$\,m w(x)\,\ge \,f(x) w(x) \,\ge\, M w(x)\,\, \forall x \in [a,b]$$

Which leads to: $$\,m \int_{a}^{b}{w(x)dx}\,\ge  \, \int_{a}^{b}{f(x)}{w(x)dx}\,\ge\, M \int_{a}^{b}{w(x)dx}\,\, \forall x \in [a,b]$$

We can now divide through by $$\int_{a}^{b}{w(x)dx}$$

To get $$\,m \,\le \, \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\int_{a}^{b}{w(x)dx}}\,\le\, M \, \forall x \in [a,b]$$

Since f(x) is continuous, there must be at least one value &xi; on the interval [a,b]; such that $$f(\xi) = \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\int_{a}^{b}{w(x)dx}}$$

Plugging this value into the original statement $$\int_{a}^{b}{w(x)f(x)dx} = f(\xi)\int_{a}^{b}{w(x)dx} = \frac{\int_{a}^{b}{f(x)}{w(x)dx}}{\cancel{\int_{a}^{b}{w(x)dx}}}\cancel{\int_{a}^{b}{w(x)dx}}  =  \int_{a}^{b}{w(x)f(x)dx}$$

proves the theorem.

Solved by Erle Fields and Taeho Kim.

Given

 * $$\displaystyle f(x)=3x-2x^3, \; x \in [0,1]$$


 * $$\displaystyle g(x)=\sinh(x), \; x \in [0,1]$$

Objectives

 * 1. Plot $$\displaystyle f(x)$$ and $$\displaystyle g(x)$$.


 * 2. Find $$||f(x)||_\infty$$, $$||g(x)||_\infty$$ , and $$||f(x)-g(x)||_\infty$$.

Solution
1. Plotting the functions

The following MATLAB code was used to plot f(x) from x=0 to x=1:



Similarly for g(x):



2. Evaluating the Infinity Norms


 * $$||f(x)||_\infty = max(|f(x)|)$$

As seen in Figure 3 above f(x) has a local maxima within the interval $$ x \in [0,1]$$, and will be determined by inspection of the derivative of f(x):


 * $$ \frac{d}{dx}f(x) = 3-6x^2$$

Solving for the x-value for which f(x) attains its local maxima:


 * $$ \frac{d}{dx}f(x) = 3-6x^2=0$$
 * $$\Rightarrow x = \frac{\sqrt{2}}{2}$$

Then solving for the local maximum of f(x):


 * $$\displaystyle f(\frac{\sqrt{2}}{2})=3*\frac{\sqrt{2}}{2}-2*(\frac{\sqrt{2}}{2})^{3} = \sqrt{2}$$


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

$$\displaystyle \Rightarrow ||f(x)||_\infty=\sqrt{2} $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.


 * $$||g(x)||_\infty = max(|g(x)|)$$

As can be seen in figure 4 above, g(x) on the interval $$x \in [0,1]$$ attains its maximum at x=1.


 * $$max(|g(x)|) = g(1) = sinh(1) \approx 1.1752$$


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

$$\displaystyle \Rightarrow ||g(x)||_\infty \approx 1.1752 $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.


 * $$||f(x)-g(x)||_\infty = max(|f(x)-g(x)|)$$

The following MATLAB code was used to calculate this infinity norm:


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

$$\displaystyle \Rightarrow ||f(x)-g(x)||_\infty \approx 0.7392 $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle
 * style= |
 * }.
 * }.

Solved by William Kurth.

=Contributing Team Members= The following members have contributed to this homework assignment and have reviewed all of the presented material:
 * Egm6341.s11.team4.fields 03:43, 26 January 2011 (UTC)
 * Egm6341.s11.team4.kurth 10:03, 26 January 2011 (UTC)
 * Egm6341.s11.team4.BM 11:39, 26 January 2011 (UTC)
 * Egm6341.s11.team4.yang 08:49, 26 January 2011 (UTC)
 * Egm6341.s11.team4.hylon 10:30, 26 January 2011 (UTC)
 * Egm6341.s11.team4.KTH 20:36, 26 January 2011 (UTC)

Report formatted and compiled by William Kurth.