User:Egm6341.s11.team5/HW3

= Problem 1 - Find n st. $$Er^{T}\left(f_n^T\left(\frac{7 \pi }{8}\right)\right) < Er^{L}\left(f_5^L\left(\frac{7 \pi }{8}\right)\right)$$ = From (meeting 14 page 1)

Given
Taylor Series Expansion (meeting 3 page 2)

$$f_n^T(x)=f(x0)+\frac{(x-x0)^n}{n!} f^n(x0)$$

Lagrangian Expansion (meeting 11 page 3)

$$f_n^L\left(x\right)=\sum _{i=0}^n f\left(x_i\right) l_{i,n}(x)$$

Where

$$l_{i,n}(x)= \prod _i^n \frac{x-xli}{xlj-xli}$$

$$ i\neq j$$ and $$xl\left(1,n\right)$$ is a set of n given points

Find
A value of n such that the error of the nth Taylor expansion is equal or less than the 5th Lagrangian Expansion of the same funciton

$$\left|f\left(\frac{7 \pi }{8}\right)-f_n^T\left(\frac{7 \pi }{8}\right)\right|=\left|e_n^T\left(\frac{7 \pi }{8}\right)\right|\leq \left|f\left(\frac{7 \pi }{8}\right)-f_4^L\left(\frac{7 \pi }{8}\right)\right|=\left|e_4^L\left(\frac{7 \pi }{8}\right)\right|$$

$$f\left(x\right)=sin\left(x\right)$$

Solution
 We solved this problem on our own 

The 5th Lagrangian Interpolation Functions of $$sin\left(x\right) $$  was calculated using 5 evenly divided data points from  $$\displaystyle 0  $$ to  $$\displaystyle 2\pi $$

$$xl=\left( \begin{array}{ccccc} 0 & \frac{\pi }{4} & \frac{\pi }{2} & \frac{3 \pi }{4} & \pi \end{array} \right)$$

Resulting in

$$f\left(x_i\right)=\left( \begin{array}{ccccc} 0 & \frac{1}{\sqrt{2}} & 1 & \frac{1}{\sqrt{2}} & 0 \end{array} \right)$$

$$l_{i,5}(x)=\left( \begin{array}{c} \frac{32 (x-\pi ) \left(x-\frac{3 \pi }{4}\right) \left(x-\frac{\pi }{2}\right) \left(x-\frac{\pi }{4}\right)}{3 \pi ^4} \\ -\frac{128 x (x-\pi ) \left(x-\frac{3 \pi }{4}\right) \left(x-\frac{\pi }{2}\right)}{3 \pi ^4} \\ \frac{64 x (x-\pi ) \left(x-\frac{3 \pi }{4}\right) \left(x-\frac{\pi }{4}\right)}{\pi ^4} \\ -\frac{128 x (x-\pi ) \left(x-\frac{\pi }{2}\right) \left(x-\frac{\pi }{4}\right)}{3 \pi ^4} \\ \frac{32 x \left(x-\frac{3 \pi }{4}\right) \left(x-\frac{\pi }{2}\right) \left(x-\frac{\pi }{4}\right)}{3 \pi ^4} \end{array} \right)$$

Error from the Lagringain Interpolation evaluated at $$ x = \frac{7 \pi }{8}$$ is

$$Er^{L}=sin\left( \frac{7 \pi }{8}\right)-f_5^L\left(x\right)$$

Where $$f_5^L\left(x\right)$$ simplifies to be $$\frac{4 (\pi -x) x \left(16 \left(2 \sqrt{2}-3\right) x^2+16 \left(3-2 \sqrt{2}\right) \pi x+\left(8 \sqrt{2}-9\right) \pi ^2\right)}{3 \pi ^4}$$

Resulting in

$$\displaystyle Er^L= 0.00148078$$

To determine the nth order of Taylor series expansion necessary to be at least as accurate as the Lagringain expansion the Taylor series was calculated one order at a time and the resulting error term comprared. The generated series is presented here:

$$f_n^T\left(\frac{7 \pi }{8}\right)=$$

$$\left( \begin{array}{l} \cos \left(\frac{\pi }{8}\right) \\ \left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \\ \left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)-\frac{1}{2} \left(x-\frac{3 \pi }{8}\right)^2 \cos \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \\ -\frac{1}{6} \left(x-\frac{3 \pi }{8}\right)^3 \sin \left(\frac{\pi }{8}\right)+\left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)-\frac{1}{2} \left(x-\frac{3 \pi }{8}\right)^2 \cos \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \\ -\frac{1}{6} \left(x-\frac{3 \pi }{8}\right)^3 \sin \left(\frac{\pi }{8}\right)+\left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)+\frac{1}{24} \left(x-\frac{3 \pi }{8}\right)^4 \cos \left(\frac{\pi }{8}\right)-\frac{1}{2} \left(x-\frac{3 \pi }{8}\right)^2 \cos \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \\ \frac{1}{120} \left(x-\frac{3 \pi }{8}\right)^5 \sin \left(\frac{\pi }{8}\right)-\frac{1}{6} \left(x-\frac{3 \pi }{8}\right)^3 \sin \left(\frac{\pi }{8}\right)+\left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)+\frac{1}{24} \left(x-\frac{3 \pi }{8}\right)^4 \cos \left(\frac{\pi }{8}\right)-\frac{1}{2} \left(x-\frac{3 \pi }{8}\right)^2 \cos \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \\ \frac{1}{120} \left(x-\frac{3 \pi }{8}\right)^5 \sin \left(\frac{\pi }{8}\right)-\frac{1}{6} \left(x-\frac{3 \pi }{8}\right)^3 \sin \left(\frac{\pi }{8}\right)+\left(x-\frac{3 \pi }{8}\right) \sin \left(\frac{\pi }{8}\right)-\frac{1}{720} \left(x-\frac{3 \pi }{8}\right)^6 \cos \left(\frac{\pi }{8}\right)+\frac{1}{24} \left(x-\frac{3 \pi }{8}\right)^4 \cos \left(\frac{\pi }{8}\right)-\frac{1}{2} \left(x-\frac{3 \pi }{8}\right)^2 \cos \left(\frac{\pi }{8}\right)+\cos \left(\frac{\pi }{8}\right) \end{array} \right)$$

The resulting errors from the above Taylor series expansions evaluated at $$ x = \frac{7 \pi }{8}$$ is

$$Er^{T}=sin\left( \frac{7 \pi }{8}\right)-f_n^T\left(x\right)= \left( \begin{array}{c} 0.541196 \\ 1.14231 \\ 0.00252314 \\ 0.244677 \\ 0.0103165 \\ 0.0201805 \\ 0.000905156 \end{array} \right)$$


 * {| style="width:100%" border="0" align="left"

n=7
 * $$\therefore Er^{T}\left(f_7^T\left(\frac{7 \pi }{8}\right)\right) < Er^{L}\left(f_5^L\left(\frac{7 \pi }{8}\right)\right)$$
 * $$\therefore Er^{T}\left(f_7^T\left(\frac{7 \pi }{8}\right)\right) < Er^{L}\left(f_5^L\left(\frac{7 \pi }{8}\right)\right)$$
 * }
 * }

Author and proof-reader
[Author]J Davis 19:15, 11 February 2011 (UTC)

[Proof-reader] cavalcanti

= Problem 2 - Verification of $$G(x_i)=0$$ = From (meeting 14 page 3)

Given

 * {| style="width:100%" border="0" align="left"

G(x) := e_{n}^{L}(f;x) - \frac{q_{n+1}(x)}{q_{n+1}(t)} e_{n}^{L}(f;t) $$ $$\displaystyle = e(x) - \frac{q_{n+1}(x)}{q_{n+1}(t)} e(t) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (2-1)
 * }
 * }

Find
To show that $$\displaystyle G(x_i) = 0 $$.

Solution
 We solved on our own 

According to (2) meeting 11 page 3


 * {| style="width:100%" border="0" align="left"

e(x) = \frac{q_{n+1}(x)}{(n+1)!} f^{(n+1)} (\xi) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (2-2)
 * }
 * }


 * {| style="width:100%" border="0" align="left"

G(x) = q_{n+1}(x) \left( \frac{f^{(n+1)} (\xi)}{(n+1)!} - \frac{e(t)}{q_{n+1}(t)} \right) $$ $$
 * $$\displaystyle (2-1) \rightarrow
 * $$\displaystyle (2-1) \rightarrow
 * $$\displaystyle (2-3)
 * }
 * }

According to (3) meeting 11 page 3


 * {| style="width:100%" border="0" align="left"

q_{n+1}(x) = (x-x_0)(x-x_1) \cdot \cdot \cdot (x-x_n) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (2-4)
 * }
 * }

Therefore,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle G(x_i) = 0 \qquad $$ for $$\displaystyle \qquad (i=0, 1, \cdot \cdot \cdot, n)$$
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Author and proof-reader
[Author] Oh

[Proof-reader] Raghunathan

= Problem 3 - Plotting $$e_n^L(f,x), f_n^L(x), l_{i,n}(x), q_{n+1}(x)$$ = From (meeting 15 page 1)

Given
1. $$\displaystyle f(x)=\frac{e^x-1}{x} $$ on $$\displaystyle [-1,+1] $$, $$\displaystyle n=4 $$
 * $$\displaystyle t=5 $$, $$\displaystyle x=0.75 $$

2. $$\displaystyle f(x)=\frac{1}{1+4x^2} $$ on $$\displaystyle [-5,+5] $$, $$\displaystyle n=8 $$
 * $$\displaystyle t=4.5 $$, $$\displaystyle x=3 $$

Find
1.
 * Plot $$\displaystyle x \mbox{ vs. } f(x)$$, $$\displaystyle f_n^L(x)$$, $$\displaystyle e_n^L(x)$$, $$\displaystyle l_{i,n}(x)$$, $$\displaystyle q_{n+1}(x), n=4$$.
 * Plot $$\displaystyle l_{2,4}(\cdot)$$

2.
 * Plot $$\displaystyle x \mbox{ vs. } f(x)$$, $$\displaystyle f_n^L(x)$$, $$\displaystyle e_n^L(x)$$, $$\displaystyle l_{i,n}(x)$$, $$\displaystyle q_{n+1}(x), n=8$$.
 * Plot $$\displaystyle l_{3,8}(\cdot)$$

Addition
 * Find $$\displaystyle e_4^L(f,t)$$ and $$\displaystyle e_4^L(f,x)$$
 * Find $$\displaystyle e_8^L(f,t)$$ and $$\displaystyle e_8^L(f,x)$$

Solution
1. $$\displaystyle f(x)=\frac{e^x-1}{x}, x \in [-1,+1] $$
 * From the class notes (p.11-3), the Lagrangian interpolation error is defined as
 * {| style="width:100%" border="0" align="left"

e_4^L(f;x)=f(x)-f_4^L(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-1)
 * }
 * ,where
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

f_4^L(x) = \sum_{i=0}^4 l_{i,4}(x)f(x_i) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-2)
 * }
 * Also, the Lagrangian interpolation functions are defined as
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{i,4}(x)=\prod_{j=0}^4 \frac{x-x_j}{x_i-x_j} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-3)
 * }
 * From the class notes (p.11-3), $$\displaystyle q_{5} $$ can be computed using the equation below.
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

q_{5}(x)=\prod_{i=0}^{4}(x-x_i) $$ $$ Plot:
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-4)
 * }
 * }
 * Nm1.s11.team5.HW3.fig3a.png]
 * Nm1.s11.team5.HW3.fig3b.png]
 * Nm1.s11.team5.HW3.fig3c.png]
 * Nm1.s11.team5.HW3.fig3d.png]

Matlab code:
 * {| style="width:100%" border="0" align="left"

Addition: Find $$\displaystyle e_4^L(f,t)$$ and $$\displaystyle e_4^L(f,x)$$, $$\displaystyle t=5, x=0.75 $$
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * Using Eq (3-1),(3-2) and (3-3), $$\displaystyle e_4^L(f,t)$$ and $$\displaystyle e_4^L(f,x)$$ can be computed.
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} e_4^L(f,t)&=11.0239 \\ e_4^L(f,x)&=-1.6274 \times 10^{-4} \end{align} $$ Matlab code:
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }
 * {| style="width:100%" border="0" align="left"


 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }

2. $$\displaystyle f(x)=\frac{1}{1+4x^2}, x \in [-5,+5] $$
 * From the class notes (p.11-3), the Lagrangian interpolation error is defined as
 * {| style="width:100%" border="0" align="left"

e_8^L(f;x)=f(x)-f_8^L(x) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-5)
 * }
 * ,where
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

f_8^L(x) = \sum_{i=0}^8 l_{i,8}(x)f(x_i) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-6)
 * }
 * Also, the Lagrangian interpolation functions are defined as
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

l_{i,8}(x)=\prod_{j=0}^8 \frac{x-x_j}{x_i-x_j} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-7)
 * }
 * From the class notes (p.11-3), $$\displaystyle q_{9} $$ can be computed using the equation below.
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

q_{9}(x)=\prod_{i=0}^{8}(x-x_i) $$ $$ Plot:
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (3-8)
 * }
 * }
 * Nm1.s11.team5.HW3.fig3e.png]
 * Nm1.s11.team5.HW3.fig3f.png]
 * Nm1.s11.team5.HW3.fig3g.png]
 * Nm1.s11.team5.HW3.fig3h.png]

Matlab code:
 * {| style="width:100%" border="0" align="left"

Addition: Find $$\displaystyle e_8^L(f,t)$$ and $$\displaystyle e_8^L(f,x)$$, $$\displaystyle t=4.5, x=3 $$
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * Using Eq (3-5),(3-6) and (3-7), $$\displaystyle e_8^L(f,t)$$ and $$\displaystyle e_8^L(f,x)$$ can be computed.
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} e_8^L(f,t)&=1.784 \\ e_8^L(f,x)&=-0.3786 \end{align} $$ Matlab code:
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }
 * {| style="width:100%" border="0" align="left"


 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }

Author and proof-reader
[Author] Shin

[Proof-reader]

= Problem 4 - Area of a Bifolium = From (meeting 15 page 2)

Given
The bifolium: $$\displaystyle r(\theta)=2sin(\theta)cos^{2}(\theta)$$, where $$\displaystyle \theta=[0,\pi]$$.

Find
1. Do literature search to find history and application, if any, of this classic curve. 2. Find the area of one folium,with an accuracy of $$10^{-6}$$ by:
 * 2.1 Composite trapezoidal
 * 2.2 Composite Simpson
 * 2.3 Area of triangles

Solution by J Davis
''' We solved this problem on our own. '''

1. Lit research The bifolium is the pedal curve of the deltoid where the pedal point is the midpoint of one of the three curved sides. Eric W. "Bifolium." From MathWorld--A Wolfram Web Resource)

The implicit properties of the Bifolium curve can be found here: 

The word folium means leaf-shaped.

The general form of the folium is given by the formula in polar coordinates as

$$\displaystyle r = -b cos\theta + 4a cos\theta sin2\theta$$

There are three special forms of the folium, the simple folium, the double folium and the trifolium. These correspond to the cases where

$$\displaystyle b = 4a, b = 0, b = a $$ 

The bifolium has been studied by Longchamps (1886) and Brocard (1887), and is also named the double folium.



It was Johann Kepler (1609) who was the first to describe the curve. Therefore the curve is also known as Kepler's folium.

 The curve bears striking resembalance to the Folium of Descartes, although no direct relation could be found other than name and apperance. 

2. Area of one folium: The aera of an equation in polar form is found by the following integral formula

$$\frac{1}{2} \int_{a}^{b} r\left(\theta \right)^2\,d\theta$$,

Aplying this formula to the Bifolium funciton we get

$$A=\frac{1}{2} \int_0^{\frac{\pi }{2}} \left(2 \sin (\theta ) \cos ^2(\theta )\right)^2 \, d\theta $$

Integrating from $$0$$ to $$\frac{\pi }{2}$$ inorder to find the area of only one leaf resulting in excatly

$$A=\frac{\pi }{16}$$

The integration above will be approximated by the following methods

Evaluating the formulas and equations in polar form prevents the need to find the area between the curves by subtracting the area of one from the other.
 * 2.1 Composite Trapezoidal

The generalized function is:

$$I_n = \sum _{i=0}^{n-1} \left\{\frac{h}{2} \left(f\left(x_{i}\right)+f\left(x_{i+1}\right)\right)\right\}$$ where

$$h=\frac{b-a}{n}, x_i = a + h i,\text{ for }i=0, 1, \dots, n$$

This rule is only valid for uniformly spaced data points.

Appling to the Bifolium funciton we get

$$\frac{1}{2}\sum _{i=0}^{n-1} \left\{\frac{h}{2} \left(r\left(\theta _{i}\right){}^2+r\left(\theta _{i+1}\right){}^2\right)\right\}$$

for $$n=2,a=0,b=\frac{\pi}{2}$$

$$h=\frac{\pi}{4}, \theta _{i}=\frac{i \pi}{4}$$

$$A=\frac{1}{2} \sum _{i=0}^1 \frac{\pi}{8}  \left(\left(2 \sin ^2\left(\frac{\pi}{4}(i+1)\right) \cos \left(\frac{\pi}{4}(i+1)\right)\right)^2+\left(2 \sin ^2\left(\frac{\pi}{4}i\right) \cos \left(\frac{\pi}{4}i\right)\right)^2\right)$$

Evaluating this $$A=\frac{\pi}{16}$$

Using the Composite Trapezoidal rule to find the area of one leaf of the Bifolium curve, in polar coordinates, only two sections are required to achive the exact answer. Matlab code to evaluate this is given below.


 * 2.2 Composite Simpson

$$I_n = \sum _{i=0}^{n-1} \left\{\frac{h}{3} \left(f\left(x_{i}\right)+4f\left(\frac{x_{i}+x_{i+1}}{2}\right)+f\left(x_{i+1}\right)\right)\right\}$$ where

$$h=\frac{b-a}{n}, x_i = a + h i,\text{ for }i=0, 1, \dots, n$$

This rule is also only valid for uniformly spaced data points.

Appling to the Bifolium funciton we get

$$\frac{1}{2}\sum _{i=0}^{n-1} \left\{\frac{h}{3} \left(r\left(\theta _{i}\right)^{2}+r\left(\frac{\theta _{i}+\theta _{i+1}}{2}\right)^{2}+r\left(\theta _{i+1}\right)^{2}\right)\right\} $$

for $$n=2,a=0,b=\frac{\pi}{2}$$

$$h=\frac{\pi}{4}, \theta _{i}=\frac{i \pi}{4} $$

$$A=\frac{1}{2} \sum _{i=0}^1 -\frac{1}{6} \left(\frac{\pi i}{4}-\frac{\pi  (i+1)}{4} \right) \left(4 \sin ^4\left(\frac{\pi  i}{4}\right) \cos ^2\left(\frac{\pi  i}{4}\right)+4 \sin ^4\left(\frac{\pi  (i+1)}{4} \right) \cos ^2\left(\frac{\pi  (i+1)}{4} \right)+16 \sin ^4\left(\frac{\left(\frac{\pi  i}{4}+\frac{\pi (i+1) }{4} \right)}{2} \right) \cos ^2\left(\frac{\left(\frac{\pi  i}{4}+\frac{\pi (i+1) }{4} \right)}{2} \right)\right) $$

Which simplifies to

$$\frac{1}{2} \left(\frac{1}{24} \pi \left(\frac{1}{2}+16 \sin ^2\left(\frac{\pi }{8}\right) \cos ^4\left(\frac{\pi }{8}\right)\right)+\frac{1}{24} \pi  \left(\frac{1}{2}+16 \sin ^4\left(\frac{\pi }{8}\right) \cos ^2\left(\frac{\pi }{8}\right)\right)\right)$$

Which when evaluated results in an error of $$\displaystyle 2.7755575615628914x10^{-17}$$

Using the Composite Simpson rule to find the area of one leaf of the Bifolium curve, in polar coordinates, only two sections are required to achive the answer within the tolorance of $$\displaystyle 10^{-6}$$ . Matlab code to evaluate this is given below.


 * 2.3 Area of triangles

The first step is to convert the curve to cartesion form and find the x and y coordinates of n points along the curve

This can be done with the following formulas

$$h=\frac{b-a}{n}, Pts_i = h i,\text{ for }i=0, 1, \dots, n$$

$$fx_i:=f(Pts_i) Cos(Pts_i),fy_i:=f(Pts_i) Sin(Pts_i),\text{ where } f(Pts_i):=2 \sin ^2\left(Pts_i\right) \cos \left(Pts_i\right)$$

The area of a triangle arbitrairly oriented in space is found from the coordinates of the verticies

$$\frac{1}{2} \left[-x_2 y_1+x_3 y_1+x_1 y_2-x_3 y_2-x_1 y_3+x_2 y_3\right]$$

For this application one of the verticies is at the origen, we will chose $$x_3=0,y_3=0$$

Simplifiing the above to

$$\frac{1}{2} \left(x_1 y_2-x_2 y_1\right)$$

The total area is found by calculating the area of each triangle formed by two sequential points and the origen. One possible algrothymn is as follows

$$\sum _{i=1}^{n-1} \frac{1}{2} \left(fx\left(Pts_{i}\right) fy\left(Pts_{i+1}\right)-fx\left(Pts_{i+1}\right) fy\left(Pts_{i}\right)\right)$$

1140 triangular divisions were required to achive an error of less than $$10^{-6}.$$ Convergence of the error is presented in a log-log plot below. Matlab code to evaluate this is given below.



Matlab code:
 * {| style="width:100%" border="0" align="left"


 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }

Solution by Shin
The bifolium has the following mathematical equation.
 * {| style="width:100%" border="0" align="left"

r(t)=2\sin(t)\cos^2(t) \mbox{, } t \in [0, \pi] $$ $$ In this problem, we're only interested in computing the area in one leaf, so $$\displaystyle t $$ will have the different range.
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (4-1)
 * }
 * }
 * $$\displaystyle t \in [0, \frac{\pi}{2}]$$

In order to apply composite Trapezoidal rule and composite Simpson's rule, we need to have the equation expressed in the Cartesian coordinate system. We have the following properties to obtain the equation defined in the Cartesian coordinate system.
 * {| style="width:100%" border="0" align="left"

\begin{align} \sin(t)&=\frac{y}{r} \\ \cos(t)&=\frac{x}{r} \\ r&=\sqrt{x^2+y^2} \end{align} $$ $$ Substitute Eq(4-2) to Eq(4-1) then, we have the following equation expressed in terms of $$\displaystyle x,y $$.
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (4-2)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

(x^2+y^2)^2=2x^2y $$ $$ Before jumping into the calculation of area, it should be noted that the values that $$\displaystyle x $$ can take on are different from $$\displaystyle t \in [0,\frac{\pi}{2}]$$. But, it can be found out simply by running the following code. Matlab code:
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (4-3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

As a result, $$\displaystyle x $$ is in the range of the following.
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * $$\displaystyle x \in [0.0, 0.6495] $$

In order to obtain $$\displaystyle y $$ corresponding to $$\displaystyle x $$ in the range mentioned above, the following equation needs to be solved. The equation below is derived from Eq(4-3) by expanding out Eq(4-3) and expressing in terms of $$\displaystyle y $$.
 * {| style="width:100%" border="0" align="left"

y^4+2x^2y^2-2x^2y+x^4=0 $$ $$ Eq(4-4) is the 4th-order polynomial equation expressed in terms of $$\displaystyle y $$. In this equation, the terms expressed in $$\displaystyle x $$ will be considered as coefficients. Eq(4-4) can be solved using MATLAB command 'roots'. Area computed using Wolfram Alpha The area of one leaf in bifolium is $$\displaystyle \frac{\pi}{16} $$. (Refer to Wolfram Alpha) 1. Composite Trapezoidal rule
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (4-4)
 * }
 * }
 * From the class notes (p.7-4), the composite Trapezoidal rule is defined as below.
 * {| style="width:100%" border="0" align="left"

I_n=h(\dfrac{1}{2}f(x_0)+f(x_1)+f(x_2)+...+f(x_{n-1})+\dfrac{1}{2}f(x_{n})) \mbox{, }h=\dfrac{b-a}{n} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (4-5)
 * }
 * The area can be computed by subtracting the integration on the upper curve by the integration on the lower curve on one leaf.
 * {| style="width:100%" border="0" align="left"
 * {| style="width:100%" border="0" align="left"

AREA=I_{upper}-I_{lower} $$ $$ Matlab code:
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (4-6)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

Result:
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} n&=10000 \\ Area&=0.196349420478339 \\ Accuracy&=1.203710234265465 \times 10^{-7} \end{align} $$ 2. Composite Simpson's rule
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }
 * From the class notes (p.7-4), the composite Simpson's rule is defined as below.
 * {| style="width:100%" border="0" align="left"

I_n=\dfrac{h}{3}(f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+...+2f(x_{n-2})+4f(x_{n-1})+f(x_n))\mbox{, }h=\frac{b-a}{n} $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle (4-7)
 * }
 * The area can be computed in the same way as in Eq(4-6).
 * The area can be computed in the same way as in Eq(4-6).

Matlab code:
 * {| style="width:100%" border="0" align="left"

Result:
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} n&=10000 \\ Area&=0.196349471145946 \\ Accuracy&=6.9703415817024 \times 10^{-8} \end{align} $$
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }

3. Sum of Triangles The area on the bifolium can be computed by summing all areas of triangle divided in uniform angle. Matlab code:
 * {| style="width:100%" border="0" align="left"

Result:
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * style="width:50%; padding:10px; border:1px solid #888888" align="center" |
 * }
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} n&=10000 \\ Area&=0.196349527930081 \\ Accuracy&=1.291928136692988 \times 10^{-8} \end{align} $$
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }

Author and proof-reader
[Author]J Davis 01:56, 15 February 2011 (UTC) Shin 04:50, 15 February 2011 (UTC) [Proof-reader] cavalcanti

= Problem 5 - Proof of expression of the error, $$e^{(n+1)}(x)$$ = From (meeting 16 page 3)

Given
Expression of the error such that: $$\displaystyle e^{(n+1)}(x)=f^{(n+1)}(x)-0$$.

Find
Show that: $$\displaystyle e^{(n+1)}(x)=f^{(n+1)}(x)$$.

Solution
''' We solved this problem on our own. '''

The error for the Lagrange Interpolation can be found using: $$e^{L}_{n}(x)=f(x)-f_{n}(x)$$ For simplicity, we will rewrite the equation as follows: $$\displaystyle e(x)=f(x)-f_{n}(x)$$ Taking the first derivative, $$e^{(1)}(x)=f^{(1)}(x)-f_{n}^{1}(x)$$ Taking the derivative again, $$e^{(2)}(x)=f^{(2)}(x)-f_{n}^{2}(x)$$ . . . Similarly, $$e^{(n)}(x)=f^{(n)}(x)-f_{n}^{1}(x)$$ $$e^{(n+1)}(x)=f^{(n+1)}(x)-f_{n}^{n+1}(x)$$ We know that $$f_{n}(x)$$ is a polynomial of degree n,So $$f_{n}^{(n+1)}=0$$.
 * {| style="width:100%" border="0" align="left"


 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |

$$\therefore e^{(n+1)}(x)=f^{(n+1)}(x)$$


 * }
 * }
 * }

Author and proof-reader
[Author] cavalcanti

[Proof-reader] Raghunathan

= Problem 6 - Verification of $$q_{n+1}^{(n+1)}(x) = (n+1)!$$ =

From (meeting 16 page 3)

Given

 * {| style="width:100%" border="0" align="left"

$$
 * $$\displaystyle q_{n+1}(x) = (x-x_0)(x-x_1) \cdot \cdot \cdot (x-x_n) $$
 * <p style="text-align:right;">$$\displaystyle (6-1)
 * <p style="text-align:right;">$$\displaystyle (6-1)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Find

 * {| style="width:100%" border="0" align="left"

$$
 * $$\displaystyle q_{n+1}^{(n+1)}(x) = (n+1)!$$
 * <p style="text-align:right;">$$\displaystyle (6-2)
 * <p style="text-align:right;">$$\displaystyle (6-2)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Solution
 We solved on our own 

Restate, $$\displaystyle (6-1) $$
 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle q_{n+1}(x) = x^{n+1} + C_n \cdot x^n + C_{n-1} \cdot x^{n-1} + \cdot \cdot \cdot + C_0 \cdot x^0$$
 * $$\displaystyle q_{n+1}(x) = x^{n+1} + C_n \cdot x^n + C_{n-1} \cdot x^{n-1} + \cdot \cdot \cdot + C_0 \cdot x^0$$

$$\displaystyle ( C_i$$ is coefficient of $$\displaystyle x^i $$ where $$\displaystyle i=0, 1, \cdot \cdot \cdot, n )$$ $$
 * <p style="text-align:right;">$$\displaystyle (6-3)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle q_{n+1}^{(1)}(x) = (n+1) \cdot x^{n} + n \cdot C_n \cdot x^{n-1} + (n-1) \cdot C_{n-1} \cdot x^{n-2} + \cdot \cdot \cdot + \underbrace{C_0 \cdot x^0}_{ \rightarrow 0}$$
 * $$\displaystyle q_{n+1}^{(1)}(x) = (n+1) \cdot x^{n} + n \cdot C_n \cdot x^{n-1} + (n-1) \cdot C_{n-1} \cdot x^{n-2} + \cdot \cdot \cdot + \underbrace{C_0 \cdot x^0}_{ \rightarrow 0}$$

$$
 * <p style="text-align:right;">$$\displaystyle (6-4)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"

q_{n+1}^{(2)}(x) = (n+1) \cdot n \cdot x^{n-1} + n \cdot (n-1) \cdot C_n \cdot x^{n-2} + (n-1) \cdot (n-2) \cdot C_{n-1} \cdot x^{n-3} + \cdot \cdot \cdot + 0$$
 * $$\displaystyle
 * $$\displaystyle

$$
 * <p style="text-align:right;">$$\displaystyle (6-5)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"

$$\displaystyle \cdot $$

$$\displaystyle \cdot $$

$$\displaystyle \cdot $$
 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} q_{n+1}^{(n+1)}(x) &= (n+1) \cdot n \cdot (n-1) \cdot \cdot \cdot 2 \cdot 1 + 0 \\ &= (n+1)! \end{align} $$ $$
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * <p style="text-align:right;">$$\displaystyle (6-6)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Author and proof-reader
[Author] Oh

[Proof-reader] Shin

= Problem 7 - Verification of $$\left| E_1 \right|$$ = From (meeting 17 page 2)

Given

 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle \left| E_1 \right| \leq \frac{M_2}{2!} \int_{a}^{b} \left| q_2(x) \right| \ dx$$
 * $$\displaystyle \left| E_1 \right| \leq \frac{M_2}{2!} \int_{a}^{b} \left| q_2(x) \right| \ dx$$

$$ \ = \frac{M_2}{2!} \int_{a}^{b} \underbrace{(x-a)}_{\geq 0} \left|\underbrace{(x-b)}_{\leq 0} \right| \ dx$$ $$
 * <p style="text-align:right;">$$\displaystyle (7-1)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Find

 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle (7-1) \rightarrow \frac{(b-a)^3}{12} M_2 \ = \frac{h^3}{12} M_2 \qquad (h := b-a)$$
 * }
 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Solution
 We solved on our own 


 * {| style="width:100%" border="0" align="left"

\begin{align} (7-1) &= \frac{M_2}{2!} \int_{a}^{b} (-x^2+(a+b)x-ab) \ dx \\ &= \frac{M_2}{2!} \left[ -\frac{1}{3}x^3 + \frac{1}{2} (a+b) x^2 - abx \right]_{a}^{b} \\ &= \frac{M_2}{2!} \left\{ \left( - \frac{1}{3}b^3 + \frac{1}{2} (a+b) b^2 - ab^2 \right) - \left( - \frac{1}{3}a^3 + \frac{1}{2} (a+b) a^2 - a^2 b \right) \right\} \\ &= \frac{M_2}{2!} \left( \frac{1}{6} b^3 - \frac{1}{6} a^3 - \frac{1}{2} ab^2 + \frac{1}{2} a^2 b \right) \\ &= \frac{M_2}{2!} \frac{1}{6} \left( b-a \right)^3 \end{align} $$
 * $$\displaystyle
 * $$\displaystyle

$$
 * <p style="text-align:right;">$$\displaystyle (7-2)
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

There fore,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle (7-1) = \frac{(b-a)^3}{12} M_2 = \frac{h^3}{12} M_2 \qquad (h := b-a) $$
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * style="width:50%; padding:10px; border:2px solid #8888aa" align="center" |
 * }
 * }
 * }


 * {| style="width:100%" border="0" align="left"


 * }
 * }
 * }

Author and proof-reader
[Author] Oh

[Proof-reader] Shin

=  Problem 8 - Verification of $$\left| E_2 \right| $$  = From (meeting 17 page 3)

Given

 * {| style="width:100%" border="0" align="left"

\left| \right| \le \frac\int_a^b {\left| {(x - a)\left( {x - \frac{2}} \right)(x - b)} \right|dx} $$ $$
 * <p style="text-align:right;">$$\displaystyle (8-1)
 * }
 * }

Find
Show that Eq (8-1) is
 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} &=\frac{M_3} \\ &= \frac{M_3} \end{align} $$ $$
 * <p style="text-align:right;">$$\displaystyle (8-2)
 * }
 * }

Solution

 * {| style="width:100%" border="0" align="left"

\displaystyle \begin{align} \frac\int_a^b {\left| {(x - a)\left( {x - \frac{2}} \right)(x - b)} \right|dx}&=\frac\int_a^{\frac{2}} {(x - a)\left( {-x + \frac{2}} \right)(-x + b)dx} \\ &+ \frac\int_{\frac{2}}^b {(x - a)\left( {x - \frac{2}} \right)(-x + b)dx} \end{align} $$ $$ Solving the first term
 * <p style="text-align:right;">$$\displaystyle (8-3)
 * }
 * }
 * {| style="width:100%" border="0" align="left"

\frac\int_a^{\frac{2}} {(x - a)\left( {-x + \frac{2}} \right)(-x + b)dx}$$ $$= \int_a^{\frac{2}}- \frac{2} + \frac{2} - \frac{2} + 2abx - \frac{2} + \frac{2} - \frac{2} + {x^3} $$ $$=\left. { - \frac{2} + \frac{4} - \frac{2} + ab{x^2} - \frac{2} + \frac{4} - \frac{2} + \frac{4}} \right|_a^{\frac{2}}$$ <p style="text-align:right;">$$\displaystyle (8-4) $$ Evaluating at $$x=\frac{b+a}{2}$$ and $$x=a$$ gives respectively
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$=- \frac{1}{4}{a^2}{b^2}$$ <p style="text-align:right;">$$\displaystyle (8-5) $$ Expanding these terms and subtracting gives
 * $$=\frac{1}({a^2} + {b^2}){(a + b)^2} + \frac{3}{(a + b)^4}$$
 * $$=\frac{1}({a^2} + {b^2}){(a + b)^2} + \frac{3}{(a + b)^4}$$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<p style="text-align:right;">$$\displaystyle (8-6) $$ Solving the second term
 * $$\frac{1}\left( {{a^4} - 4{a^3}b + 6{a^2}{b^2} - 4a{b^3} + {b^4}} \right) = \frac{1}{(b - a)^4}$$
 * $$\frac{1}\left( {{a^4} - 4{a^3}b + 6{a^2}{b^2} - 4a{b^3} + {b^4}} \right) = \frac{1}{(b - a)^4}$$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$=\frac{2} - \frac{2} + \frac{2} - 2abx + \frac{2} - \frac{2} + \frac{2} - {x^3}$$ $$=\left. {\frac{2} - \frac{4} + \frac{2} - ab{x^2} + \frac{2} - \frac{4} + \frac{2} - \frac{4}} \right|_{\frac{2}}^b$$ <p style="text-align:right;">$$\displaystyle (8-7) $$ Evaluating at $$x=b$$ and $$x=\frac{b+a}{2}$$ gives respectively
 * $$\frac\int_{\frac{2}}^b {(x - a)\left( {x - \frac{2}} \right)(-x + b)dx} $$
 * $$\frac\int_{\frac{2}}^b {(x - a)\left( {x - \frac{2}} \right)(-x + b)dx} $$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

$$=- \frac{1}({a^2} + {b^2}){(a + b)^2} - \frac{3}{(a + b)^4}$$ <p style="text-align:right;">$$\displaystyle (8-8) $$ Expanding these terms and subtracting gives
 * $$= \frac{1}{4}{a^2}{b^2}$$
 * $$= \frac{1}{4}{a^2}{b^2}$$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<p style="text-align:right;">$$\displaystyle (8-9) $$ Adding Eq (8-6) and (8-9) as Eq (8-3) shows, we get
 * $$\frac{1}\left( {{a^4} - 4{a^3}b + 6{a^2}{b^2} - 4a{b^3} + {b^4}} \right) = \frac{1}{(b - a)^4}$$
 * $$\frac{1}\left( {{a^4} - 4{a^3}b + 6{a^2}{b^2} - 4a{b^3} + {b^4}} \right) = \frac{1}{(b - a)^4}$$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<p style="text-align:right;">$$\displaystyle (8-10) $$ Then
 * $$\frac{1}{(b - a)^4}$$
 * $$\frac{1}{(b - a)^4}$$
 * }
 * }
 * {| style="width:100%" border="0" align="left"

<p style="text-align:right;">$$\displaystyle (8-11) $$ Eq (8-11) is equivalent to Eq (8-2) therefor Eq (8-1) is equivalent to Eq (8-2)
 * $$\left( {\frac} \right)\left( {\frac{1}{{(b - a)}^4}} \right) = \frac$$
 * $$\left( {\frac} \right)\left( {\frac{1}{{(b - a)}^4}} \right) = \frac$$
 * }
 * }

= References =

= Contributing members =

Signatures
Oh, Sangmin Solved and posted Problem 2, 6 and 7 04:07, 10 February 2011 (UTC) cavalcanti Solved and posted problem 5, partial problem 4, and proof read. 19:40, 13 February 2011 (UTC) Shin Solved and posted problem 3,4 and proof-read 6,7. 04:55, 15 February 2011 (UTC) Raghunathan Solved problems manually.Prof-read 3.2,3.5,3.8. 17:00,16 February 2011(UTC).

J Davis 14:44, 16 February 2011 (UTC) Solved and posted the solutions for problems 1 and 4 Reiss, Phillip Solved and posted problem 8