University of Florida/Egm6341/s10.Team2/HW1

Problem Statement
Find $$\lim_{x\rightarrow 0}\frac{e^{x}-1}{x}$$ and plot graph of the function for $$x \in \left [ 0,1 \right ]$$

Solution
This limit cannot be performed directly since it yields $$\frac{0}{0}$$ form. So, the L'Hôpitals Rule technique must be used:

L'Hôpitals Rule States:

$$\lim_{x\rightarrow c} \frac{f(x)}{g(x)} = \lim_{x\rightarrow c} \frac{f'(x)}{g'(x)}$$

as long as f and g are functions that are differentiable on an open interval (a,b) which contains c, except at c itself.

Applying this technique the following is found:

$$f(x)=e^{x}-1   \qquad f'(x)= e^{x}$$

$$g(x)=x \qquad   g'(x)=1$$

$$\lim_{x\rightarrow 0} \frac{e^{x}-1}{x} = \lim_{x\rightarrow 0} \frac{e^{x}}{1} = e^{0}=1$$

Graph of $${x}$$ (on X-axis) versus $$ \frac{e^{x}-1}{x} $$ (on Y-axis)



 MATLAB Code: 

To generate the graph for $${x}$$ vs $$\frac{e^{x}-1}{x} $$

Solution for problem 1: Guillermo Varela 19:41, 27 January 2010 (UTC) and Srikanth Madala 19:41, 27 January 2010 (UTC)

Proofread problem 1: Guillermo Varela 19:41, 27 January 2010 (UTC) and Srikanth Madala 19:41, 27 January 2010 (UTC)

Problem Statement
Pg. 2-3, Find $$P_{n}(x)$$ and $$R_{n+1}(x)$$  of $$ e^{x} $$

Solution
The Taylor's series expansion for any function f(x) can be expressed as follows:

$$\displaystyle f(x)= P_{n}(x) + R_{n+1}(x)$$ where

$$P_{n}(x)= {f}(x_{0})+ \frac{(x-x_{0})}{1!} {f}'(x_{0})+.....+ \frac{(x-x_{0})^{n}}{n!} {f}^{n}(x_{0})$$

$$R_{n+1}(x)= \frac{1}{n!}\int_{x_{0}}^{x} (x-t)^{n} f^{n+1}(t) dt$$

If f(x) is considered to be $$e^x$$, then by using the above expansion, $$P_{n}(x)$$ becomes:

$$P_{n}(x)= e^{x_{0}} + \frac{(x-x_{0})}{1!} e^{x_{0}} + \frac{(x-x_{0})^{2}}{2!} e^{x_{0}} +.....+ \frac{(x-x_{0})^{n}}{n!} e^{x_{0}}$$

Let $${x_{0}}=0$$, then:

$$\begin{matrix}P_{n}(x)&=& e^{0} + \frac{x}{1!} e^{0} + \frac{x^{2}}{2!} e^{0} +.....+ \frac{x^{n}}{n!} e^{0}\\ \\ &=&1+ \frac{x}{1!} + \frac{x^{2}}{2!} +...........+ \frac{x^{n}}{n!} \end{matrix} $$

Similarly, $$R_{n+1}(x)$$ becomes:

$$R_{n+1}(x)= \frac{1}{n!}\int_{{t=x_{0}}=0}^{t=x} (x-t)^{n} e^{t} dt$$

Using Integral mean value theorem (IMVT):

$$\begin{matrix}R_{n+1}(x)&=&\frac{e^{\xi_x}}{n!}\int_{0}^{x} (x-t)^{n} dt\\ \\&=&\frac{e^{\xi_x}}{n!} \frac{x^{n+1}}{n+1} =\frac{x^{n+1} \ e^{\xi_x}}{n+1!}\end{matrix}$$

where $$\xi_x$$ lies in $$\left [ 0,x \right ]$$

Solution for problem 2: Srikanth Madala 19:41, 27 January 2010 (UTC)

Proofread problem 2: Egm6341.s10.team2.patodon 04:21, 21 February 2010 (UTC)

Problem Statement
Pg. 3-3.

$$ f(x)=sin(x) \qquad \qquad g(x)=sin(x-\frac{\pi}{2})=-cos(x) $$

Plot f and g

$$\ x\epsilon [0,\pi] $$

Find Infinity norm of

i)$$ \left \| f(x) \right \|_{\infty} $$

ii)$$ \left \| g(x) \right \|_{\infty} $$

iii)$$ \left \| f(x)-g(x) \right \|_{\infty} $$

Solution
The Infinity norm is defined as follows:

$$ \left \| f(.) \right \|_{\infty} = max \left | f(x) \right | $$

Using this definition the following is identified:

i) $$ \left \| sin(x) \right \|_{\infty} = 1 $$

ii) $$ \left \| -cos(x) \right \|_{\infty} = 1 $$

iii) $$ \left \| sin(x)+cos(x) \right \|_{\infty} = 1.4142 $$



Solution for problem 3: Guillermo Varela

Problem Statement
Pg 5-1.

Prove the Integral Mean Value Theorem (IMVT) p. 2-3 for w(.) non-negative. i.e $$\ w\geq0 $$

Solution
We have the IMVT as

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

For a given function $${f(x)}$$ Let m be the minimum of the function and M be the maximum of the same function

Then we know that, $${m \leq f(x)\leq M}$$

multiplying the inequality throughout by $${w(x) \geq 0}$$ and integrating between $${[a,b]}$$ we get:

$${\int_{a}^{b}m. w(x)dx \leq \int_{a}^{b} f(x).w(x)dx \leq \int_{a}^{b}M.w(x)dx}$$

$${m\int_{a}^{b} w(x)dx \leq \int_{a}^{b} f(x).w(x)dx \leq M\int_{a}^{b}w(x)dx}$$

writing $${\int_{a}^{b}w(x) = I}$$, we get

$${mI\leq \int_{a}^{b} f(x)w(x)dx \leq MI}$$

It is seen that when w(x) = 0, the result is valid. Consider the case when w(x) > 0

dividing throughout by $${I}$$

$${m\leq \frac{1}{I}\int_{a}^{b} f(x)w(x)dx \leq M}$$

From the Intermediate Value Theorem, we know that there exists $${\xi \in \left [ a,b \right ] }$$ such that

$${f(\xi )= \frac{1}{I}\int_{a}^{b} f(x)w(x)dx}$$

i.e

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

Hence Proved

Solution for problem 4: --Egm6341.s10.team2.niki 23:22, 20 February 2010 (UTC)

Proofread problem 4:

Problem Statement
Pg. 5-1. Use the integral mean value theorem (IMVT) to show eq. 5 P. 2-2 yields the equation 1 of pg. 2-3.

Solution


Solution for problem 5: Jiang Pengxiang

Proofread problem 5: Srikanth Madala 19:41, 27 January 2010 (UTC)

Problem Statement
Pg. 5-3. Repeat integration by parts to reveal

$$ \frac{(x-x_{0})^{2}}{2!}f^{(2)}(x_{0})+ \frac{(x-x_{0})^{3}}{3!}f^{(3)}(x_{0})$$

Plus the remainder.

Next, Assume eq. 4 and 5 of Pg. 2-2 are true, do integration by parts once more.

Solution
From Meeting 5 lecture notes:

$$\begin{array}{lcr} f(x)&=&f(x_{0})+\int_{x_{0}}^{x}f^{(1)}(t)dt \end{array}\!$$

Integration by parts yields:

$$\begin{array}{lcr} f(x)&=&f(x_{0})+\frac{x-x_{0}}{1!}f^{(1)}(x_{0})+\int_{x_{0}}^{x}(x-t)f^{(2)}(t)dt \end{array}\!$$

Performing integration by parts on the integral in the above result:

$$\begin{array}{lcr} \int_{x_{0}}^{x}(x-t)f^{(2)}(t)dt\\ = \int_{x_{0}}^{x}u'v\\ =[uv]_{x_{0}}^{x}-\int uv'\\ =[(tx-\frac{t^{2}}{2})(f^{(2)})(t)]^{x}_{x_{0}}-\int_{x_{0}}^{x}(tx-\frac{t^{2}}{2})(tf^{(3)}(t))dt\\ =(\frac{x^{2}}{2})(f^{(2)}(x))-(x_{0}x-\frac{x_{0}^{2}}{2})(f^{(2)}(x_{0}))-\int_{x_{0}}^{x}(tx-\frac{t^{2}}{2})(tf^{(3)}(t))dt\\ =(\frac{x^{2}}{2})(f^{(2)}(x))+(\frac{x_{0}^{2}}{2})(f^{(2)}(x_{0}))-(x_{0}x)f^{(2)}(x_{0})-\int_{x_{0}}^{x}(tx-\frac{t^{2}}{2})(tf^{(3)}(t))dt\\ =\int_{x_{0}}^{x}(\frac{x^{2}}{2})(f^{(3)}(t))dt+x_{0}xf^{(2))}(x_{0}) \end{array}\!$$

Solution for problem 6: Egm6341.s10.team2.patodon 04:15, 21 February 2010 (UTC)

Proofread problem 6: Guillermo Varela

Problem Statement
Pg. 6-1

$$\ f(x)=sin(x) \ \forall \ x\epsilon[0,\pi] $$

Construct Taylor Series of f(.) around $$ x_{0}\approx \frac{\pi}{4} $$ for n=0,1,...,10 and plot for each n.

Solution
The Taylor's series expansion for any function $$f(x)$$ can be expressed as follows:

$$\displaystyle f(x)= P_{n}(x) + R_{n+1}(x)$$ where

$$P_{n}(x)= {f}(x_{0})+ \frac{(x-x_{0})}{1!} {f}'(x_{0})+.....+ \frac{(x-x_{0})^{n}}{n!} {f}^{n}(x_{0})$$

$$R_{n+1}(x)= \frac{1}{n!}\int_{x_{0}}^{x} (x-t)^{n} f^{n+1}(t) dt$$

If $$f(x)$$ is considered to be $$\sin x$$, $$n=10$$ and $$x_{0}=\frac{\pi}{4}$$, then by using the above expansion, $$P_{n}(x)$$ and $$R_{n+1}(x)$$ becomes:

$$P_{10}(x)= \sin \frac{\pi}{4} + \left [ \frac{(x-\frac{\pi}{4})}{1!} \cos \frac{\pi}{4} \right ] - \left [ \frac{(x-\frac{\pi}{4})^{2}}{2!} \sin \frac{\pi}{4} \right ] - \left [ \frac{(x-\frac{\pi}{4})^{3}}{3!} \cos \frac{\pi}{4}\right ] + \left [ \frac{(x-\frac{\pi}{4})^{4}}{4!} \sin \frac{\pi}{4} \right ] +.....+ \left [ \frac{(x-\frac{\pi}{4})^{10}}{10!} {f}^{10}(\frac{\pi}{4})\right ]$$

where $${f}^{10}(\frac{\pi}{4})= -\sin(\frac{\pi}{4})$$ (Please see the below Matlab code for more elaborate expansion)

$$R_{11}(x)= \frac{1}{10!}\int_{t=\frac{\pi}{4}}^{t=x} (x-t)^{10} f^{11}(t) dt$$

where $${f}^{11}\left ( t \right )= -\cos\left ( t \right )$$ (Please see the below Matlab code for more elaborate expansion)



 MATLAB Code: 

To generate the equation for $$P_{n}(x)$$

To generate the equation for $$R_{n+1}(x)$$

To generate the graph for $$x$$ vs $$y=f(x)= P_{n}(x) + R_{n+1}(x)$$; where $$x \in \left [ 0,\pi \right ]$$

Solution for problem 7: Srikanth Madala 19:41, 27 January 2010 (UTC)

Proofread problem 7: Egm6341.s10.team2.patodon 04:22, 21 February 2010 (UTC)

Problem Statement
Pg. 6-5

$$ I = \int_{0}^{1}\frac{\exp^{x}-1}{x}dx $$

Use 3 methods to find In:

1) Taylor Series Expansion, Fn 2) Composite Trapezoidal Rule 3) Composite Simpson Rule

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

Solution 1
1)Taylor Series Expansion

The goal is to perform the following integration,

$$ I = \int_{0}^{1}\frac{\exp^{x}-1}{x}dx $$

The problem with this is that it is an indefinite integral, which must be rewritten in another way in order to analyze it. The method discussed here will be Taylor Series Expansion or McClaurin Series Expansion. The function can be rewritten as follows:

The Taylor Series Expansion for $$ \exp^{x} $$

$$ \exp^{x}= \sum_{j=0}^{\infty} \frac{x^{j}}{j!} = 1 + \sum_{j=1}^{\infty} \frac{x^{j}}{j!} $$

$$ \exp^{x} - 1 = 1 + \sum_{j=1}^{\infty} \frac{x^{j}}{j!} -1 = \sum_{j=1}^{\infty} \frac{x^{j}}{j!} $$

$$ \frac{exp^{x} - 1}{x} = \sum_{j=1}^{\infty} \frac{x^{j-1}}{j!} = f(x)$$

Using this new definition for the function one can then integrate it directly as follows:

$$I = \int_{0}^{1} \sum_{j=1}^{n} \frac{x^{j-1}}{j!} dx $$

Integrating this for a value of n=2 yields the following:

$$I = \int_{0}^{1} \sum_{j=1}^{n=2} \frac{x^{j-1}}{j!} dx $$

$$I = \int_{0}^{1} \frac{x^{0}}{1!} + \frac{x^{1}}{2!} dx = \left [ x \right ]_{0}^{1} + \left [ \frac{x^{2}}{4} \right ]_{0}^{1} = 1 + \frac{1}{4}=1.25$$

For n=4:

$$I = \int_{0}^{1} \frac{x^{0}}{1!} + \frac{x^{1}}{2!} + \frac{x^{2}}{3!} + \frac{x^{3}}{4!} dx = \left [ x \right ]_{0}^{1} + \left [ \frac{x^{2}}{4} \right ]_{0}^{1} + \left [ \frac{x^{3}}{18} \right ]_{0}^{1} + \left [ \frac{x^{4}}{96} \right ]_{0}^{1} = 1 + \frac{1}{4} + \frac{1}{18} + \frac{1}{96} = 1.3160$$

The percent difference between the actual value of the integral (1.3179022) and the estimated value is found by:

$$ \left | \frac{estimate-actual}{actual} \right | \times 100\% = \left | \frac{1.25-1.3179022}{1.3179022}  \right | \times 100\% = 5.15\% $$

The following are the results for other values of n until the error is reduced to the power of $$10^{-6} $$

Matlab Code used to generate the values for the table:

function I =taylor(n) i=1; Itot=0; It=0; while i<=n if i==1 Itot=1; else It=1/(factorial(i)*i); end Itot=Itot+It; i=i+1; end I=Itot;

Solution 2
2)Composite Trapezoidal Rule The formula used to analyze the integral for a function using the composite trapezoidal rule is as follows:

$$ \int_{a}^{b}F(x)dx = (b-a) \frac{f(x_{0})+2\sum_{i=1}^{n-1}f(x_{i})+f(x_{n})}{2n} $$

It is also necessary to state the following, using L'Hopitals Rule

$$ \lim_{0} \frac{\exp^{x}-1}{x} = 1 $$

For n=2 the integration is approximated as follows:

$$ \int_{0}^{1}\frac{\exp^{x}-1}{x}dx $$

$$ x(1)=.5 x(2)=1 $$

$$ I=(1-0) \frac{f(x_{0})+2f(x_{1})+f(x_{2})}{4} = (1) \frac{1+(2\times1.2974)+1.7183}{4} = 1.328 $$

The error is calculated by comparing it to the results obtained using the Taylor Series expansion, as follows:

$$ Error = \frac{\left | Trapezoidal Value - Taylor Value \right |} {\left | Taylor Value \right |} \times 100\%= \frac{\left | 1.328-1.3179 \right |}{1.3179} \times 100\% = .7664\% $$

This table displays the results for similar values:

Matlab Code used to generate the values for the estimates:

function I=ctrapz(n) i=0; Itot=0; It=0; It2=0; h=0; while i<=n if i==0 Itot1=1; else if i<n h=1/n; It(i)=2*valu(h*i); else It2=valu(1); end end Itot=Itot1+sum(It)+It2; i=i+1; end I=Itot/(2*n);

function F= valu(x); F=(exp(x)-1)/x;

Solution 3
The Composite Simpson's Rule

The rule is defined as follows:

$$I_{n}= (b-a) \frac{f(x_{0}+4\sum_{i=1,3,5..}^{n-1}f(x_{i})+2\sum_{j=2,4,6...}^{n-2}f(x_{j})+f(x_{n})}{3n}$$

Using this definition the following is found:

The Following MATLAB code was used to generate the values:

function I = simpb(a,b,w)

q=1; i=a; n=0; Sum=0; c=0;

while n<w n=2^q; h=(a+b)/n; while i<=b fx=(exp(i)-1)/(i); if i==a Sum=1; else if i==b Sum=Sum+fx; else if i==(b-h) Sum=Sum+(4*fx); else if rem(c,2)==0 Sum=Sum+(2*fx); else Sum=Sum+(4*fx); end end end end c=c+1; i=i+h; end n    In=Sum*(h/3); I=In; i=a; c=0; q=q+1; Sum=0; end

By Comparing all of the methods one is able to conclude that the most efficient method to numerically integrate was the composite Simpson's rule.

Solution for problem 8: Guillermo Varela

Problem Statement
Pg. 7-1

$$\frac{\mathbf{[e^x -1]}} = {\frac{1}{x}[e^x-1]} = {f(x)}$$

1) Expand $$\exp^{x}$$ in Taylor Series w/ remainder:

$$ {R(x) = \frac{(x-0)^{n+1}}{(n+1)!}exp \left[ \zeta(x) \right] }$$

2) Find Taylor Series Expansion and Remainder of f(x). eq. 4 of p 6-3.

Solution
Given:

$${P_{n}(x)=f(x_{0})+\frac{(x-x_{0})}{1!}f^{(1)}(x_{0})+...+\frac{(x-x_{0})^{n}}{n!}f^{(n)}(x_{0})}$$[equation 4 p 2-2]

$$ {R(x) = \frac{(x-0)^{n+1}}{(n+1)!}exp \left[ \zeta(x) \right] }$$ [equation 1 p 2-3]

Part 1
$${P_{n}(x)=e^{x_{0}}+\frac{(x-x_{0})}{1!}e^{x_{0}}+...+\frac{(x-x_{0})^{n}}{n!}e^{x_{0}}}$$

for the case that $$x_{0}=0$$, we get,

$${P_{n}(x)=1+\frac{(x)}{1!}+...+\frac{(x)^{n}}{n!}}$$

$${P_{n}(x)}$$ =$${\sum_{j=0}^{\infty }\frac{x^{j}}{j!}}$$

Using equation 1 p 2-3, we get the remainder as

$$ {R_{n+1}(x) = \frac{(x-x_{0})^{n+1}}{(n+1)!}f^{(n+1)} (\zeta(x))}$$

for $$x_{0}=0$$, we get

$${R_{n+1}(x) = \frac{(x)^{n+1}}{(n+1)!}f^{(n+1)} (\zeta(x))}$$

finally, $${f(x)= e^x = \sum_{j=0}^{\infty } \frac{x^{j}}{j!} + \frac{(x)^{n+1}}{(n+1)!}f^{(n+1)} (\zeta(x)) = \sum_{j=0}^{\infty } \frac{x^{j}}{j!} + \frac{(x)^{n+1}}{(n+1)!}e^{ (\zeta(x))}}$$

Part 2
$${f(x)=\frac{1}{x}[e^{x}-1]}$$

$${e^{x}=\sum_{j=0}^{\infty }\frac{x^j}{j!} = 1+ \frac{x}{1!}+\frac{x^2}{2!}+...+\frac{x^n}{n!}}$$

$$\therefore {[e^x -1]= \frac{x}{1!}+\frac{x^2}{2!}+...+\frac{x^n}{n!}}$$

dividing both sides by x we get,

$${\frac{[e^x - 1]}{x} = f(x) = \sum_{j=1}^{\infty } \frac{x^{j-1}}{j!}}$$

and remainder becomes

$${R_{n+1}(x) = \frac{(x)^{n}}{(n+1)!}f^{(n+1)} (\zeta(x))}$$

since $$x_{0}= 0$$, we have

$${R_{n+1}(x) = \frac{(x)^{n}}{(n+1)!}f^{(n+1)} (\zeta(x)}$$ where $$\zeta (x) )\epsilon [0,x]$$

Finally,

$${f(x)= \frac{[e^x -1 ]}{x} = \sum_{j=1}^{\infty } \frac{x^{j-1}}{j!} + \frac{(x)^{n}}{(n+1)!}f^{(n+1)} (\zeta(x)) =\sum_{j=1}^{\infty } \frac{x^{j-1}}{j!} + \frac{(x)^{n}}{(n+1)!}e^{(\zeta(x))}}$$

Solution for problem 9: Egm6341.s10.team2.niki 23:23, 20 February 2010 (UTC)

Proofread problem 9:

Problem Statement
P. 8-2.

Use eq. 2 of pg. 8-2 to obtain eq. 1 of Pg. 7-1.

Solution


Solution for problem 10: Jiang Pengxiang

Proofread problem 10: Srikanth Madala 19:41, 27 January 2010 (UTC)

Problem Statement
P. 8-3

show eq. 4 is equal to eq. 2 by expanding eq. 4.

Solution
Equation 2:

$$\begin{array}{lcl} p_{2}(x_{j})&=&f(x_{j}) \end{array}$$

Equation 4:

$$\begin{array}{lcl} p_{2}(x_{j})&=&\sum_{i=0}^{2}\vartheta _{i}(x_{j})f(x_{i})\;\;\;\;\;\;\;\;\;\;\;\;\;\;For\;j=0,1,2\\ \end{array}\!$$

Performing summation:

$$\begin{array}{lcl} p_{2}(x_{j})&=& \sum_{i=0}^{2}\vartheta _{i}(x_{j})f(x_{i})\\ &=& \vartheta _{0}(x_{j})f(x_{0})+\vartheta _{1}(x_{j})f(x_{1})+\vartheta _{2}(x_{j})f(x_{2})\\ \end{array}$$

Definition of Kronecker delta [[media:Egm6341.s10.mtg8.pdf|Meeting 8 Notes]] :

$$\vartheta _{i}(x_{j})=\delta _{ij}=\left\{\begin{matrix} 1 & i=j\\ 0 & i\neq j \end{matrix}\right.$$

Therefore,

$$\vartheta _{i}(x_{j})f(x_{i})=0\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;For\;i\neq j\!$$

$$\vartheta _{i}(x_{j})f(x_{i})=f(x_{i=j})\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;For\;i=j\!$$

For $$j=0,1,\;or\;2\!$$, two of the three terms resulting from the summation over index-j are negated. Since two of the terms will have i where $$i\neq j$$ and therefore $$\vartheta _{i}(x_{j})$$ equal to $$0\!$$ for those two terms and $$\vartheta _{i}(x_{j})$$ equal to $$1\!$$ for the remaining one term where $$\;i=j\!$$.

Thus,

$$p_{2}(x_{j})=f(x_{j})\!$$

Solution for problem 11: Egm6341.s10.team2.patodon 04:16, 21 February 2010 (UTC)

Proofread problem 11:

Contributing Authors
--Niki Nachappa Chenanda Ganapathy 16:20, 27 January 2010 (UTC)

--Guillermo Varela 19:23, 27 January 2010 (UTC)

--Srikanth Madala 19:41, 27 January 2010 (UTC)

--Patrick O'Donoughue 20:12, 27 January 2010 (UTC)

--Jiang Pengxiang 21:13, 27 January 2010 (UTC)<br/