<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Numerical Analysis (aimee)</title>
	<atom:link href="http://aimeemarie88.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://aimeemarie88.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 12 Dec 2008 00:17:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='aimeemarie88.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Numerical Analysis (aimee)</title>
		<link>http://aimeemarie88.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://aimeemarie88.wordpress.com/osd.xml" title="Numerical Analysis (aimee)" />
	<atom:link rel='hub' href='http://aimeemarie88.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Newton&#8217;s Divided Difference (2)</title>
		<link>http://aimeemarie88.wordpress.com/2008/12/12/newtons-divided-difference-2/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/12/12/newtons-divided-difference-2/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 00:09:34 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=170</guid>
		<description><![CDATA[We learned a more efficient way to code Newton’s divided difference in class last week. We began by trying the code with the equation with five equally spaced points: f=@(x) sin(pi*x) n=5 x=linspace(-1,1,n)&#8217; c=zeros(n,1) F=f(x) c(1)=F(1) for i=1:n-1 F = diff(F)./(x(i+1:n)-x(1:n-i)) c(i+1)=F(1) end m=101; xx = linspace(-1,1,m)&#8217;; phi = ones(m,n); for i=2:n phi(:,i) = phi(:,i-1).*(xx-x(i-1)); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=170&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--><br />
We learned a more efficient way to code Newton’s divided difference in class last week. We began by trying the code with the equation <img src='http://s0.wp.com/latex.php?latex=f%28x%29%3Dsin%28%5Cpi%2Ax%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)=sin(&#92;pi*x)' title='f(x)=sin(&#92;pi*x)' class='latex' /> with five equally spaced points:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">f=@(x) sin(pi*x)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">n=5</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">x=linspace(-1,1,n)&#8217;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">c=zeros(n,1) </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">F=f(x)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">c(1)=F(1) </span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">for</span><span style="font-size:10pt;font-family:Courier;color:black;"> i=1:n-1</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> F = diff(F)./(x(i+1:n)-x(1:n-i))</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> c(i+1)=F(1)</span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">end </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">m=101;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">xx = linspace(-1,1,m)&#8217;; </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">phi = ones(m,n); </span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">for</span><span style="font-size:10pt;font-family:Courier;color:black;"> i=2:n</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> phi(:,i) = phi(:,i-1).*(xx-x(i-1));</span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">end </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">P=phi*c;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">plot(xx,f(xx),</span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">&#8216;-r&#8217;</span><span style="font-size:10pt;font-family:Courier;color:black;">)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">hold </span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">on</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">plot(xx,P,</span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">&#8216;-ob&#8217;</span><span style="font-size:10pt;font-family:Courier;color:black;">)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-184" title="sinpix" src="http://aimeemarie88.files.wordpress.com/2008/12/sinpix.jpg?w=480" alt="sinpix"   /></span></p>
<p class="MsoNormal">With the error:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-185" title="sin_equi_error" src="http://aimeemarie88.files.wordpress.com/2008/12/sin_equi_error.jpg?w=480" alt="sin_equi_error"   /></span></p>
<p>Using the same function with Gaussian points:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-186" title="sin_gauss" src="http://aimeemarie88.files.wordpress.com/2008/12/sin_gauss.jpg?w=480" alt="sin_gauss"   /></span></p>
<p>With the error:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-187" title="sin_gauss_error" src="http://aimeemarie88.files.wordpress.com/2008/12/sin_gauss_error.jpg?w=480" alt="sin_gauss_error"   /><br />
</span></p>
<p class="MsoNormal">
<p class="MsoNormal"><span style="font-size:10pt;"> </span></p>
<p>Next we used Gaussian points with the equation <img src='http://s0.wp.com/latex.php?latex=f%28x%29%3D+%5Cfrac%7B1%7D%7B1%2B4x%5E2%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)= &#92;frac{1}{1+4x^2}' title='f(x)= &#92;frac{1}{1+4x^2}' class='latex' /></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:forestgreen;">%f=@(x) sin(pi*x) </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">f=@(x) 1./(1+4.*x.^2) </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">n=7</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:forestgreen;">%x=linspace(-1,1,n)&#8217;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">x = -cos(pi*(0:n-1)/(n-1)) </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">c=zeros(n,1) </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">F=f(x)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">c(1)=F(1) </span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">for</span><span style="font-size:10pt;font-family:Courier;color:black;"> i=1:n-1</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> F = diff(F)./(x(i+1:n)-x(1:n-i))</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> c(i+1)=F(1)</span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">end </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">m=101;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">xx = linspace(-1,1,m)&#8217;; </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">phi = ones(m,n); </span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">for</span><span style="font-size:10pt;font-family:Courier;color:black;"> i=2:n</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> phi(:,i) = phi(:,i-1).*(xx-x(i-1));</span></p>
<p class="MsoNormal" style="text-indent:.5in;"><span style="font-size:10pt;font-family:Courier;color:blue;">end </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">P=phi*c; </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">plot(xx,f(xx),</span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">&#8216;-r&#8217;</span><span style="font-size:10pt;font-family:Courier;color:black;">)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">hold </span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">on</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">plot(xx,P,</span><span style="font-size:10pt;font-family:Courier;color:#a020f0;">&#8216;-ob&#8217;</span><span style="font-size:10pt;font-family:Courier;color:black;">)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-188" title="runge_gauss" src="http://aimeemarie88.files.wordpress.com/2008/12/runge_gauss.jpg?w=480" alt="runge_gauss"   /></span></p>
<p class="MsoNormal">With the error:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-189" title="runge_gauss_error" src="http://aimeemarie88.files.wordpress.com/2008/12/runge_gauss_error.jpg?w=480" alt="runge_gauss_error"   /></span></p>
<p class="MsoNormal">Using the same function with equidistant points:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-190" title="runge_equi" src="http://aimeemarie88.files.wordpress.com/2008/12/runge_equi.jpg?w=480" alt="runge_equi"   /></span></p>
<p class="MsoNormal">With the error:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><img class="alignnone size-full wp-image-191" title="runge_equi_error" src="http://aimeemarie88.files.wordpress.com/2008/12/runge_equi_error.jpg?w=480" alt="runge_equi_error"   /><br />
</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"> </span></p>
<p>I thought it would be interesting to do a little research into finding out some more information on the Runge Phenomenon. The Runge phenomenon occurs with polynomial interpolation for polynomials of high degree. The higher the order of the polynomial used, the larger the bound of error becomes, showing that instead of moving towards zero, the error is increasing.</p>
<p>Using equally spaced points, as the degree of the polynomial increases, the error near the endpoints gets increasingly larger. It can be proven that the error of the Runge phenomenon using equally spaced points will approach infinity as the degree of the polynomial increases. This contradicts the Weierstrass approximation theorem that explains that there exists a sequence of approximating polynomials with the error converging to zero.</p>
<p class="MsoNormal">The following picture demonstrates this:</p>
<p class="MsoNormal"><img class="alignnone size-full wp-image-172" title="graph1" src="http://aimeemarie88.files.wordpress.com/2008/12/graph1.jpg?w=480" alt="graph1"   /></p>
<p class="MsoNormal"><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><br />
The red curve is the Runge function.</p>
<p>The blue curve is a 5th order interpolating polynomial.</p>
<p>The green curve is a 9th order interpolating polynomial</p>
<p>At the interpolating points, the error between the function <img src='http://s0.wp.com/latex.php?latex=f%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)' title='f(x)' class='latex' /> and the polynomial <img src='http://s0.wp.com/latex.php?latex=p%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x)' title='p(x)' class='latex' /> is zero. Between the interpolating points, especially near the endpoints, as the degree of the polynomial increases, the error increases.</p>
<p>The following table shows the Runge function, its derivatives, and their evaluations at <img src='http://s0.wp.com/latex.php?latex=x%3D1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x=1' title='x=1' class='latex' /></p>
<table class="MsoTableGrid" style="border:medium none;border-collapse:collapse;height:178px;" border="1" cellspacing="0" cellpadding="0" width="622">
<tbody>
<tr>
<td style="border:1pt solid windowtext;width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=f%28x%29%3D+%5Cfrac%7B1%7D%7B1%2B25x%5E2%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)= &#92;frac{1}{1+25x^2}' title='f(x)= &#92;frac{1}{1+25x^2}' class='latex' /></td>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=%7Cf%281%29%7C%3D0.038462&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|f(1)|=0.038462' title='|f(1)|=0.038462' class='latex' /></td>
</tr>
<tr>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=f%27%28x%29%3D+-%5Cfrac%7B50x%7D%7B%281%2B25x%5E2%29%5E2%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;(x)= -&#92;frac{50x}{(1+25x^2)^2}' title='f&#039;(x)= -&#92;frac{50x}{(1+25x^2)^2}' class='latex' /></td>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=%7Cf%27%281%29%7C%3D0.073964&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|f&#039;(1)|=0.073964' title='|f&#039;(1)|=0.073964' class='latex' /></td>
</tr>
<tr>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=f%27%27%28x%29%3D+%5Cfrac%7B50%2A%2875x%5E2-1%29%7D%7B%281%2B25x%5E2%29%5E3%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;&#039;(x)= &#92;frac{50*(75x^2-1)}{(1+25x^2)^3}' title='f&#039;&#039;(x)= &#92;frac{50*(75x^2-1)}{(1+25x^2)^3}' class='latex' /></td>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=%7Cf%27%27%281%29%7C%3D0.210514&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|f&#039;&#039;(1)|=0.210514' title='|f&#039;&#039;(1)|=0.210514' class='latex' /></td>
</tr>
<tr>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=f%27%27%27%28x%29%3D+%5Cfrac%7B-15000x%2825x%5E2-1%29%7D%7B%2825x%5E2%2B1%29%5E4%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;&#039;&#039;(x)= &#92;frac{-15000x(25x^2-1)}{(25x^2+1)^4}' title='f&#039;&#039;&#039;(x)= &#92;frac{-15000x(25x^2-1)}{(25x^2+1)^4}' class='latex' /></td>
<td style="width:221.4pt;padding:0 5.4pt;" width="295" valign="top"><img src='http://s0.wp.com/latex.php?latex=%7Cf%27%27%27%281%29%7C%3D0.787788&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|f&#039;&#039;&#039;(1)|=0.787788' title='|f&#039;&#039;&#039;(1)|=0.787788' class='latex' /></td>
</tr>
</tbody>
</table>
<p>Since the magnitude of higher order derivatives of the Runge function gets larger, the bound for error for higher order polynomial interpolations is larger.</p>
<p>The Runge phenomenon shows that using equally spaced points with interpolation of higher degree polynomials can cause problems. Using Gaussian points, the error appears to be more regular, oscillations are minimized, and the error decreases as the degree of the polynomial interpolation increases.</p>
<p class="MsoNormal">Using the cubic spline interpolation method can help to avoid this since it uses piecewise polynomials.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=170&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/12/12/newtons-divided-difference-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/sinpix.jpg" medium="image">
			<media:title type="html">sinpix</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/sin_equi_error.jpg" medium="image">
			<media:title type="html">sin_equi_error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/sin_gauss.jpg" medium="image">
			<media:title type="html">sin_gauss</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/sin_gauss_error.jpg" medium="image">
			<media:title type="html">sin_gauss_error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/runge_gauss.jpg" medium="image">
			<media:title type="html">runge_gauss</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/runge_gauss_error.jpg" medium="image">
			<media:title type="html">runge_gauss_error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/runge_equi.jpg" medium="image">
			<media:title type="html">runge_equi</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/runge_equi_error.jpg" medium="image">
			<media:title type="html">runge_equi_error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/graph1.jpg" medium="image">
			<media:title type="html">graph1</media:title>
		</media:content>
	</item>
		<item>
		<title>A Try at Newton&#8217;s Divided Difference</title>
		<link>http://aimeemarie88.wordpress.com/2008/12/09/a-try-at-newtons-divided-difference/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/12/09/a-try-at-newtons-divided-difference/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:35:44 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=127</guid>
		<description><![CDATA[When looking for a method that can be more useful in cases where the Lagrange polynomial may not work as well, Newton’s divided differences is one possibility. Starting with the interpolating polynomial: Imposing the conditions: And finding: Etc… One advantage this method has over the Lagrange method is that the degree of p can be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=127&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--><br />
When looking for a method that can be more useful in cases where the Lagrange polynomial may not work as well, Newton’s divided differences is one possibility. Starting with the interpolating polynomial:</p>
<p><img src='http://s0.wp.com/latex.php?latex=p%28x%29%3Da_0%2Ba_1%28x-x_0%29%2Ba_2%28x-x_0%29%28x-x_1%29%2B+%5Cldots+%2Ba_n%28x-x_0%29%28x-x_1%29+%5Cldots+%28x-x_n-1%29+&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x)=a_0+a_1(x-x_0)+a_2(x-x_0)(x-x_1)+ &#92;ldots +a_n(x-x_0)(x-x_1) &#92;ldots (x-x_n-1) ' title='p(x)=a_0+a_1(x-x_0)+a_2(x-x_0)(x-x_1)+ &#92;ldots +a_n(x-x_0)(x-x_1) &#92;ldots (x-x_n-1) ' class='latex' /></p>
<p>Imposing the conditions:</p>
<p><img src='http://s0.wp.com/latex.php?latex=p%28x_1%29%3Df%28x_i%29%2Ci%3D0%2C1%2C+%5Cldots+%2Cn&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x_1)=f(x_i),i=0,1, &#92;ldots ,n' title='p(x_1)=f(x_i),i=0,1, &#92;ldots ,n' class='latex' /></p>
<p>And finding:</p>
<p><img src='http://s0.wp.com/latex.php?latex=a_0%3Dp%28x_0%29%3Df%28x_0%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_0=p(x_0)=f(x_0)' title='a_0=p(x_0)=f(x_0)' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=a_1%3D%5Cfrac%7Bp%28x_1%29-a_0%7D%7Bx_1-x_0%7D%3D%5Cfrac%7Bf%28x_1%29-f%28x_0%29%7D%7Bx_1-x_0%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_1=&#92;frac{p(x_1)-a_0}{x_1-x_0}=&#92;frac{f(x_1)-f(x_0)}{x_1-x_0}' title='a_1=&#92;frac{p(x_1)-a_0}{x_1-x_0}=&#92;frac{f(x_1)-f(x_0)}{x_1-x_0}' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=a_2%3D%5Cfrac%7Bp%28x_2%29-a_0-a_1%28x_2-x_0%29%7D%7B%28x_2-x_0%29%28x_2-x_1%29%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_2=&#92;frac{p(x_2)-a_0-a_1(x_2-x_0)}{(x_2-x_0)(x_2-x_1)}' title='a_2=&#92;frac{p(x_2)-a_0-a_1(x_2-x_0)}{(x_2-x_0)(x_2-x_1)}' class='latex' /></p>
<p>Etc…</p>
<p>One advantage this method has over the Lagrange method is that the degree of p can be increased from <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n' title='n' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n+1' title='n+1' class='latex' /> by adding the term:</p>
<p><img src='http://s0.wp.com/latex.php?latex=a_%7Bn%2B1%7D%28x-x_0%29%28x-x_1%29+%5Cldots+%28x-x_%7Bn-1%7D%29%28x-x_n%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_{n+1}(x-x_0)(x-x_1) &#92;ldots (x-x_{n-1})(x-x_n)' title='a_{n+1}(x-x_0)(x-x_1) &#92;ldots (x-x_{n-1})(x-x_n)' class='latex' /></p>
<p>There would only need to be a calculation done for this specific added point, rather than in the Lagrange formula where every term would change.</p>
<p>Since the term <img src='http://s0.wp.com/latex.php?latex=a_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_n' title='a_n' class='latex' /> depends only on <img src='http://s0.wp.com/latex.php?latex=f%2Cx_0%2Cx_1%2C+%5Cldots+x_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f,x_0,x_1, &#92;ldots x_n' title='f,x_0,x_1, &#92;ldots x_n' class='latex' />, the nth divided difference can be expressed as <img src='http://s0.wp.com/latex.php?latex=a_n%3Df%5Bx_o%2Cx_1%2C+%5Cldots+%2Cx_n%5D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a_n=f[x_o,x_1, &#92;ldots ,x_n]' title='a_n=f[x_o,x_1, &#92;ldots ,x_n]' class='latex' /></p>
<p>With some algebraic manipulation, the divided difference can be represented as:</p>
<p><img src='http://s0.wp.com/latex.php?latex=f%5Bx_0%2Cx1%2C...%2Cx_n%5D%3D%5Cfrac%7Bf%5Bx_1%2C...%2Cx_n%5D-f%5Bx_0%2C...%2Cx_%7Bn-1%7D%5D%7D%7Bx_n-x_0%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f[x_0,x1,...,x_n]=&#92;frac{f[x_1,...,x_n]-f[x_0,...,x_{n-1}]}{x_n-x_0}' title='f[x_0,x1,...,x_n]=&#92;frac{f[x_1,...,x_n]-f[x_0,...,x_{n-1}]}{x_n-x_0}' class='latex' /> for any value of n. Newton’s divided difference can be easier to use than the Vandermonde matrix method because it uses a lower or upper triangular matrix, rather than the more complicated Vandermonde matrix.</p>
<p>I found a website: <a href="http://www.math.ucla.edu/~ronmiech/YAN/ndivdiff.html">http://www.math.ucla.edu/~ronmiech/YAN/ndivdiff.html</a> that will generate the upper triangular matrix for Newton’s divided difference. Using this program and 5 values on the interval [-1,1] with the function sin(pi*x), I received the following</p>
<p>-1.0000   -0.5000         0        0.5000    1.0000</p>
<p>0       -1.0000         0        1.0000         0</p>
<p>-2.0000    2.0000    2.0000   -2.0000         0</p>
<p>4.0000         0       -4.0000         0             0</p>
<p>-2.6667   -2.6667         0             0             0</p>
<p>I tried to write a MATLAB code to compute the matrix. With some knowledge of MATLAB and compiling various sources of MATLAB help, I came up with the following code:</p>
<p>x=[-1 -.5 0 .5 1];</p>
<p>y=[sin(-pi) sin(-.5.*pi) 0 sin(0.5*pi) sin(pi)];</p>
<p>n=length(x);</p>
<p>c=zeros(n,n+1);</p>
<p>c(:,1)=x&#8217;;</p>
<p>c(:,2)=y&#8217;;</p>
<p>for j=3:n+1;</p>
<p>for i=j-1:n;</p>
<p>i1=i-j+2;</p>
<p>c(i,j)=( c(i,j-1)-c(i-1,j-1) )/( c(i,1)-c(i1,1) );</p>
<p>end;</p>
<p>end;</p>
<p>c’</p>
<p>This code yielded the following matrix</p>
<p>-1.0000   -0.5000         0    0.5000    1.0000</p>
<p>-0.0000   -1.0000         0    1.0000    0.0000</p>
<p>0   -2.0000    2.0000    2.0000   -2.0000</p>
<p>0         0    4.0000         0   -4.0000</p>
<p>0         0         0   -2.6667   -2.6667</p>
<p>The two matrices are relatively the same, except that the columns are in a different order, so it seems as though the code worked well.</p>
<p>The interpolation polynomial found using Newton’s method is the same as the one found using Lagrange method as well as Vandermonde method. As a theorem:</p>
<p>Given <img src='http://s0.wp.com/latex.php?latex=n%2B1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n+1' title='n+1' class='latex' /> distinct points <img src='http://s0.wp.com/latex.php?latex=x_0%2Cx_1%2C+%5Cldots+%2Cx_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_0,x_1, &#92;ldots ,x_n' title='x_0,x_1, &#92;ldots ,x_n' class='latex' /> and corresponding values <img src='http://s0.wp.com/latex.php?latex=y_o%2Cy_1%2C+%5Cldots+%2Cy_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='y_o,y_1, &#92;ldots ,y_n' title='y_o,y_1, &#92;ldots ,y_n' class='latex' /> there exists a unique polynomial <img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' /> of degree <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n' title='n' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x' title='x' class='latex' /> for which <img src='http://s0.wp.com/latex.php?latex=p%28x_i%29%3Dy_i%2Ci%3D0%2C1%2C+%5Cldots+%2Cn&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x_i)=y_i,i=0,1, &#92;ldots ,n' title='p(x_i)=y_i,i=0,1, &#92;ldots ,n' class='latex' /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=127&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/12/09/a-try-at-newtons-divided-difference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>
	</item>
		<item>
		<title>Cubic Spline (2)</title>
		<link>http://aimeemarie88.wordpress.com/2008/12/09/cubic-spline-2/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/12/09/cubic-spline-2/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 14:14:42 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=146</guid>
		<description><![CDATA[In order to code the cubic spline interpolation in MATLAB, Katie found the book Numerical Computing with MATLAB by Cleve B. Moler in the library and it gave a good description on what to do. The book explained to create the following m files: function d = splineslopes(h, delta) n = length(h) +1; a= zeros(size(h)); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=146&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--><br />
In order to code the cubic spline interpolation in MATLAB, Katie found the book Numerical Computing with MATLAB by Cleve B. Moler in the library and it gave a good description on what to do.</p>
<p>The book explained to create the following m files:</p>
<p class="MsoNormal">
<pre>function d = splineslopes(h, delta)

n = length(h) +1;
a= zeros(size(h)); b=a; c=a; r=a;

a(1:n-2) = h(2:n-1);
a(n-1) = h(n-2) + h(n-1);
b(1) = h(2);
b(2:n-1) = 2*(h(2:n-1)+h(1:n-2));
b(n) = h(n-2);
c(1) = h(1) + h(2);
c(2:n-1) = h(1:n-2);

r(1)=((h(1)+2*c(1))*h(2)*delta(1)+...
    h(1)^2*delta(2))/c(1);
r(2:n-1) = 3*(h(2:n-1).*delta(1:n-2)+...
    h(1:n-2).*delta(2:n-1));
r(n) = (h(n-1)^2*delta(n-2)+...
    (2*a(n-1)+h(n-1))*h(n-2)*delta(n-1))/a(n-1);

d = tridisolve(a,b,c,r);

function v = splinetx(x,y,u)
%SPLINETX  Textbook spline function.
%  v = splinetx(x,y,u) finds the piecewise cubic interpolatory
%  spline S(x), with S(x(j)) = y(j), and returns v(k) = S(u(k)).
%
%  See SPLINE, PCHIPTX.

%  First derivatives

   h = diff(x);
   delta = diff(y)./h;
   d = splineslopes(h,delta);

%  Piecewise polynomial coefficients

   n = length(x);
   c = (3*delta - 2*d(1:n-1) - d(2:n))./h;
   b = (d(1:n-1) - 2*delta + d(2:n))./h.^2;

%  Find subinterval indices k so that x(k) &lt;= u &lt; x(k+1)

   k = ones(size(u));
   for j = 2:n-1
      k(x(j) &lt;= u) = j;
   end

%  Evaluate spline

   s = u - x(k);
   v = y(k) + s.*(d(k) + s.*(c(k) + s.*b(k)));

function x = tridisolve(a,b,c,d)
%   TRIDISOLVE  Solve tridiagonal system of equations.
%     x = TRIDISOLVE(a,b,c,d) solves the system of linear equations
%     b(1)*x(1) + c(1)*x(2) = d(1),
%     a(j-1)*x(j-1) + b(j)*x(j) + c(j)*x(j+1) = d(j), j = 2:n-1,
%     a(n-1)*x(n-1) + b(n)*x(n) = d(n).
%
%   The algorithm does not use pivoting, so the results might
%   be inaccurate if abs(b) is much smaller than abs(a)+abs(c).
%   More robust, but slower, alternatives with pivoting are:
%     x = T\d where T = diag(a,-1) + diag(b,0) + diag(c,1)
%     x = S\d where S = spdiags([[a; 0] b [0; c]],[-1 0 1],n,n)

x = d;
n = length(x);

for j = 1:n-1
   mu = a(j)/b(j);
   b(j+1) = b(j+1) - mu*c(j);
   x(j+1) = x(j+1) - mu*x(j);
end

x(n) = x(n)/b(n);
for j = n-1:-1:1
   x(j) = (x(j)-c(j)*x(j+1))/b(j);
end

Then typing in the MATLAB command window: 

<span style="color:black;">&gt;&gt; n=5;</span>
<span style="color:black;">&gt;&gt; x=linspace(-1,1,n)';</span>
<span style="color:black;">y= sin(pi*x);</span>
<span style="color:black;">m=101;</span>
<span style="color:black;">xx = linspace(-1,1,m)';</span>
<span style="color:black;">&gt;&gt; P= splinetx(x,y,xx);</span>
<span style="color:black;">&gt;&gt; plot(xx, P)</span>
<span style="color:black;">&gt;&gt; y1 = sin(pi*xx);</span>
<span style="color:black;">&gt;&gt; plot(xx, y1)</span>
<span style="color:black;">&gt;&gt; plot(xx,y1,xx,P)</span>
<span style="color:black;">&gt;&gt; y2= abs(y1 - P);</span>
<span style="color:black;">&gt;&gt; plot(xx, y2)</span></pre>
<p>We used the code and changed the functions and amount of points to generate the following graphs today in class:</p>
<p><img class="alignnone size-full wp-image-195" title="cubic-spline1" src="http://aimeemarie88.files.wordpress.com/2008/12/cubic-spline1.jpg?w=480" alt="cubic-spline1"   /></p>
<p>sin(pi*x) with 5 points</p>
<p><img class="alignnone size-full wp-image-162" title="cubic-spline-error" src="http://aimeemarie88.files.wordpress.com/2008/12/cubic-spline-error.jpg?w=480" alt="cubic-spline-error"   /></p>
<p>error for sin(pi*x) with 5 points</p>
<p><img class="alignnone size-full wp-image-163" title="cubicspline-10" src="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-10.jpg?w=480" alt="cubicspline-10"   /></p>
<p>sin(pi*x) w 10 points</p>
<p><img class="alignnone size-full wp-image-164" title="cubicspline-10error" src="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-10error.jpg?w=480" alt="cubicspline-10error"   /></p>
<p>error for sin(pi*x) w 10 points</p>
<p><img class="alignnone size-full wp-image-166" title="cubicspline-100error1" src="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-100error1.jpg?w=480" alt="cubicspline-100error1"   /></p>
<p>error for sin(pi*x) w 100 points</p>
<p><img class="alignnone size-full wp-image-167" title="cubicspline-1000error" src="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-1000error.jpg?w=480" alt="cubicspline-1000error"   /></p>
<p>error for sin(pi*x) w 1000 points</p>
<p>We tried to use the Runge function with Gaussian points and it was able to graph the polynomial interpolation but we couldn&#8217;t get it to graph the actual function.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=146&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/12/09/cubic-spline-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubic-spline1.jpg" medium="image">
			<media:title type="html">cubic-spline1</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubic-spline-error.jpg" medium="image">
			<media:title type="html">cubic-spline-error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-10.jpg" medium="image">
			<media:title type="html">cubicspline-10</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-10error.jpg" medium="image">
			<media:title type="html">cubicspline-10error</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-100error1.jpg" medium="image">
			<media:title type="html">cubicspline-100error1</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/12/cubicspline-1000error.jpg" medium="image">
			<media:title type="html">cubicspline-1000error</media:title>
		</media:content>
	</item>
		<item>
		<title>Cubic Spline</title>
		<link>http://aimeemarie88.wordpress.com/2008/12/09/130/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/12/09/130/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 03:14:28 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=130</guid>
		<description><![CDATA[Cubic Spline DEFINITION: Suppose that are n+1 points, where . The function S(x) is called a cubic spline if there exists cubic polynomials with coefficients that satisfy the properties: (i) for and (ii) The spline passes through each data point: for (iii) The spline forms a continuous function over [a,b]: for (iv) The spline forms [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=130&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="margin:0;">Cubic Spline</p>
<p class="MsoNormal" style="margin:0;">
<p style="margin:0;">DEFINITION: Suppose that <img src='http://s0.wp.com/latex.php?latex=%7B%28x_k%2Cy_k%29%7D_%7Bk%3D0%7D%5En&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='{(x_k,y_k)}_{k=0}^n' title='{(x_k,y_k)}_{k=0}^n' class='latex' /> are n+1 points, where <img src='http://s0.wp.com/latex.php?latex=a%3Dx_0%3Cx_1+%5Cldots+%3Cx_n%3Db&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='a=x_0&lt;x_1 &#92;ldots &lt;x_n=b' title='a=x_0&lt;x_1 &#92;ldots &lt;x_n=b' class='latex' />. The function S(x) is called a cubic spline if there exists <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n' title='n' class='latex' /> cubic polynomials <img src='http://s0.wp.com/latex.php?latex=S_k%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S_k(x)' title='S_k(x)' class='latex' /> with coefficients <img src='http://s0.wp.com/latex.php?latex=S_%7Bk%2C0%7D%2CS_%7Bk%2C1%7D%2C+S_%7Bk%2C2%7D%2C+S_%7Bk%2C3%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S_{k,0},S_{k,1}, S_{k,2}, S_{k,3}' title='S_{k,0},S_{k,1}, S_{k,2}, S_{k,3}' class='latex' /> that satisfy the properties:</p>
<p style="text-indent:-.5in;margin:0 0 0 1in;">(i)                 <img src='http://s0.wp.com/latex.php?latex=S%28x%29%3DS_k%28x%29%3DS_%7Bk%2C0%7D%2BS_%7Bk%2C1%7D%28x-x_k%29%2BS_%7Bk%2C2%7D%28x-x_k%29%5E2%2BS_%7Bk%2C3%7D%28x-x_k%29%5E3&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S(x)=S_k(x)=S_{k,0}+S_{k,1}(x-x_k)+S_{k,2}(x-x_k)^2+S_{k,3}(x-x_k)^3' title='S(x)=S_k(x)=S_{k,0}+S_{k,1}(x-x_k)+S_{k,2}(x-x_k)^2+S_{k,3}(x-x_k)^3' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=x%5Cin%5Bx_k%2Cx_%7Bk%2B1%7D%5D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x&#92;in[x_k,x_{k+1}]' title='x&#92;in[x_k,x_{k+1}]' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=k%3D0%2C1%2C+%5Cldots+%2Cn-1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='k=0,1, &#92;ldots ,n-1' title='k=0,1, &#92;ldots ,n-1' class='latex' /></p>
<p style="text-indent:-.5in;margin:0 0 0 1in;">(ii)                The spline passes through each data point: <img src='http://s0.wp.com/latex.php?latex=S%28x_k%29%3DY_k&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S(x_k)=Y_k' title='S(x_k)=Y_k' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=k%3D0%2C1%2C+%5Cldots+n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='k=0,1, &#92;ldots n' title='k=0,1, &#92;ldots n' class='latex' /></p>
<p style="text-indent:-.5in;margin:0 0 0 1in;">(iii)              The spline forms a continuous function over [a,b]: <img src='http://s0.wp.com/latex.php?latex=S_k%28x_%7Bk%2B1%7D%29%3Ds_%7Bk%2B1%7D%28s_%7Bk%2B1%7D%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S_k(x_{k+1})=s_{k+1}(s_{k+1})' title='S_k(x_{k+1})=s_{k+1}(s_{k+1})' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=k%3D0%2C1.+%5Cldots+%2Cn-2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='k=0,1. &#92;ldots ,n-2' title='k=0,1. &#92;ldots ,n-2' class='latex' /></p>
<p style="text-indent:-.5in;margin:0 0 0 1in;">(iv)              The spline forms a smooth function: <img src='http://s0.wp.com/latex.php?latex=S%27_k%28x_%7Bk%2B1%7D%29%3DS%27%7Bk%2B1%7D%28x_%7Bk%2B1%7D%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;_k(x_{k+1})=S&#039;{k+1}(x_{k+1})' title='S&#039;_k(x_{k+1})=S&#039;{k+1}(x_{k+1})' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=k%3D0%2C1%2C+%5Cldots+%2Cn-2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='k=0,1, &#92;ldots ,n-2' title='k=0,1, &#92;ldots ,n-2' class='latex' /></p>
<p style="text-indent:-.5in;margin:0 0 0 1in;">(v)               The second derivative is continous: <img src='http://s0.wp.com/latex.php?latex=S%27%27_k%28x_%7Bk%2B1%7D%29%3DS%27%27%7Bk%2B1%7D%28x_%7Bk%2B1%7D%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;&#039;_k(x_{k+1})=S&#039;&#039;{k+1}(x_{k+1})' title='S&#039;&#039;_k(x_{k+1})=S&#039;&#039;{k+1}(x_{k+1})' class='latex' /></p>
<p class="MsoNormal" style="margin:0;">
<p style="margin:0;">Natural Spline: There exists a unique cubic spline with the free boundary conditions <img src='http://s0.wp.com/latex.php?latex=S%27%27%28a%29%3D0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;&#039;(a)=0' title='S&#039;&#039;(a)=0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=S%27%27%28b%29%3D0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;&#039;(b)=0' title='S&#039;&#039;(b)=0' class='latex' /></p>
<p class="MsoNormal" style="margin:0;">
<p style="margin:0;">Clamped Spline: There exists a unique cubic spline with the first derivative boundary conditions <img src='http://s0.wp.com/latex.php?latex=S%27%28a%29%3Dd_0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;(a)=d_0' title='S&#039;(a)=d_0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=S%27%28b%29%3Dd_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;(b)=d_n' title='S&#039;(b)=d_n' class='latex' /></p>
<p class="MsoNormal" style="margin:0;">
<p style="margin:0;">Theorem: Minimum Property of Clamped cubic splines: Assume <img src='http://s0.wp.com/latex.php?latex=f%5Cin+C%5E2%5Ba%2Cb%5D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#92;in C^2[a,b]' title='f&#92;in C^2[a,b]' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=S%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S(x)' title='S(x)' class='latex' /> is the unique clamped spline interpolant for <img src='http://s0.wp.com/latex.php?latex=f%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)' title='f(x)' class='latex' /> which passes through <img src='http://s0.wp.com/latex.php?latex=%7B%5Bx_k%2Cf%28x_k%29%29%7D_%7Bk%3D0%7D%5En&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='{[x_k,f(x_k))}_{k=0}^n' title='{[x_k,f(x_k))}_{k=0}^n' class='latex' /> and satisfies the clamped end conditions <img src='http://s0.wp.com/latex.php?latex=S%27%28a%29%3Df%28a%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;(a)=f(a)' title='S&#039;(a)=f(a)' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=S%27%28b%29%3Df%28b%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='S&#039;(b)=f(b)' title='S&#039;(b)=f(b)' class='latex' />. Then <img src='http://s0.wp.com/latex.php?latex=%5Cint_%7Ba%7D%5E%7Bb%7D%28S%27%27%28x%29%29%5E2dx%5Cle+%5Cint_%7Ba%7D%5E%7Bb%7D%28f%27%27%28x%29%29%5E2dx&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;int_{a}^{b}(S&#039;&#039;(x))^2dx&#92;le &#92;int_{a}^{b}(f&#039;&#039;(x))^2dx' title='&#92;int_{a}^{b}(S&#039;&#039;(x))^2dx&#92;le &#92;int_{a}^{b}(f&#039;&#039;(x))^2dx' class='latex' /></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="color:#ff80c0;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="color:#ff80c0;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=130&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/12/09/130/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>
	</item>
		<item>
		<title>Interpolation vs. Function</title>
		<link>http://aimeemarie88.wordpress.com/2008/11/22/interpolation-vs-function/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/11/22/interpolation-vs-function/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 03:21:39 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=112</guid>
		<description><![CDATA[Given the function f(x) = sin(pi*x) interpolate a polynomial for the interval [-1, 1] syms t L P n=5 x=linspace(-1,1,n) Y=sin(pi*x) for j=1:5 L(j)=1; for i=1:5 if (i~=j) L(j) = L(j)*(t-x(i))/(x(j)-x(i)); end end end P=L*Y&#8217; expand(P) ans = -27043212804868892242677135040851/10141204801825835211973625643008*t^3+108172851219475573938466140184915/40564819207303340847894502572032*t To graph the polynomial versus the function: x=[-1:.01:1] y=(108172851219475573938466140184915*x)/40564819207303340847894502572032 &#8211; (27043212804868892242677135040851*x.^3)/10141204801825835211973625643008 y1=sin(pi*x) plot(x,y,x,y1) From the graph, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=112&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">Given the function f(x) = sin(pi*x) interpolate a polynomial for the interval [-1, 1]</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">syms </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">t</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">L</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">P</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">n=5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">x=linspace(-1,1,n)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">Y=sin(pi*x)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">for</span><span style="font-size:10pt;font-family:&quot;color:black;"> j=1:5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> L(j)=1;</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">for</span><span style="font-size:10pt;font-family:&quot;color:black;"> i=1:5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">if</span><span style="font-size:10pt;font-family:&quot;color:black;"> (i~=j)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> L(j) = L(j)*(t-x(i))/(x(j)-x(i));</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">P=L*Y&#8217;</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">expand(P)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;">ans =</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;">-27043212804868892242677135040851/10141204801825835211973625643008*t^3+108172851219475573938466140184915/40564819207303340847894502572032*t</span></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">To graph the polynomial versus the function:</p>
<p class="MsoNormal">x=[-1:.01:1]</p>
<p class="MsoNormal">y=(108172851219475573938466140184915*x)/40564819207303340847894502572032 &#8211; (27043212804868892242677135040851*x.^3)/10141204801825835211973625643008</p>
<p class="MsoNormal">y1=sin(pi*x)</p>
<p>plot(x,y,x,y1)</p>
<p><a href="http://aimeemarie88.files.wordpress.com/2008/11/untitled.jpg"><img class="alignnone size-full wp-image-113" title="untitled" src="http://aimeemarie88.files.wordpress.com/2008/11/untitled.jpg?w=480" alt="untitled"   /></a></p>
<p class="MsoNormal">From the graph, it can be seen that the polynomial interpolation (which used 5 points) is the same as the actual function in exactly five places. At all other points it is very similar.</p>
<p class="MsoNormal" style="text-indent:.5in;"><!--[if !supportEmptyParas]--> <!--[endif]--></p>
<p class="MsoNormal">To graph the error:</p>
<p class="MsoNormal">y3=abs((108172851219475573938466140184915*x)/40564819207303340847894502572032 &#8211; (27043212804868892242677135040851*x.^3)/10141204801825835211973625643008-(sin(pi*x)))</p>
<p class="MsoNormal">plot(x,y3)</p>
<p><a href="http://aimeemarie88.files.wordpress.com/2008/11/untitled2.jpg"><img class="alignnone size-full wp-image-114" title="untitled2" src="http://aimeemarie88.files.wordpress.com/2008/11/untitled2.jpg?w=480" alt="untitled2"   /></a></p>
<p class="MsoNormal">Given the function f(x) = exp(x) interpolate a polynomial for the interval [-1, 1]</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">syms </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">t</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">L</span><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:#a020f0;">P</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">n=5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">x=linspace(-1,1,n)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">Y=exp(x)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">for</span><span style="font-size:10pt;font-family:&quot;color:black;"> j=1:5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> L(j)=1;</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">for</span><span style="font-size:10pt;font-family:&quot;color:black;"> i=1:5</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">if</span><span style="font-size:10pt;font-family:&quot;color:black;"> (i~=j)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> L(j) = L(j)*(t-x(i))/(x(j)-x(i));</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"> </span><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">end</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">P=L*Y&#8217;</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">expand(P)</span><span style="font-family:&quot;"></span></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;">ans =</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;">48904249067013/1125899906842624*t^4+149756602621819/844424930131968*t^3+2250200748318013/4503599627370496*t^2+13481801331389657/13510798882111488*t+1</span></p>
<p class="MsoNormal">
<p class="MsoNormal">To graph the polynomial versus the function:</p>
<p class="MsoNormal">x=[-1:.01:1]<span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal">y=48904249067013/1125899906842624*t^4+149756602621819/844424930131968*t^3+2250200748318013/4503599627370496*t^2+13481801331389657/13510798882111488*t+1</p>
<p class="MsoNormal">y2=exp(x)</p>
<p>plot(x,y,x,y2)</p>
<p><a href="http://aimeemarie88.files.wordpress.com/2008/11/untitled3.jpg"><img class="alignnone size-full wp-image-115" title="untitled3" src="http://aimeemarie88.files.wordpress.com/2008/11/untitled3.jpg?w=480" alt="untitled3"   /></a></p>
<p class="MsoNormal">Zooming in closer at a point that is not an interpolation point:</p>
<p><span style="font-size:12pt;font-family:&quot;"><!--[if gte vml 1]&gt;                    &lt;![endif]--><!--[if !vml]--><!--[endif]--></span></p>
<p><a href="http://aimeemarie88.files.wordpress.com/2008/11/untitled4.jpg"><img class="alignnone size-full wp-image-116" title="untitled4" src="http://aimeemarie88.files.wordpress.com/2008/11/untitled4.jpg?w=480" alt="untitled4"   /></a></p>
<p>If zooming in close to an interpolation point, the graphs are the same.</p>
<p class="MsoNormal">It appears from far away that the polynomial interpolation and the function are the same, but after zooming it, it is clear they are very close but not the same.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">When zooming in around zero, or one of the points that was used in interpolation, it appears that the graphs are the same, similar to what happened with the sin(pi*x) error from above.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">When graphing the error:</p>
<p class="MsoNormal">y2=abs((48904249067013*x.^4)/1125899906842624 + (149756602621819*x.^3)/844424930131968 + (2250200748318013*x.^2)/4503599627370496 + (13481801331389657*x)/13510798882111488 + 1-(exp(x)))</p>
<p class="MsoNormal">plot(x,y2)</p>
<p class="MsoNormal"><a href="http://aimeemarie88.files.wordpress.com/2008/11/untitled5.jpg"><img class="alignnone size-full wp-image-117" title="untitled5" src="http://aimeemarie88.files.wordpress.com/2008/11/untitled5.jpg?w=480&#038;h=269" alt="untitled5" width="480" height="269" /></a></p>
<p class="MsoNormal"><!--[if gte vml 1]&gt;                    &lt;![endif]--><!--[if !vml]--><!--[endif]--></p>
<p class="MsoNormal">This proves that the error is zero at the points that were interpolated.</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=112&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/11/22/interpolation-vs-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/11/untitled.jpg" medium="image">
			<media:title type="html">untitled</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/11/untitled2.jpg" medium="image">
			<media:title type="html">untitled2</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/11/untitled3.jpg" medium="image">
			<media:title type="html">untitled3</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/11/untitled4.jpg" medium="image">
			<media:title type="html">untitled4</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/11/untitled5.jpg" medium="image">
			<media:title type="html">untitled5</media:title>
		</media:content>
	</item>
		<item>
		<title>Trying to break either method</title>
		<link>http://aimeemarie88.wordpress.com/2008/11/22/trying-to-break-either-method/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/11/22/trying-to-break-either-method/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 03:01:45 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=110</guid>
		<description><![CDATA[In an attempt to find examples that can cause the Vandermonde method or Lagrange method to fail, Katie and I made up various examples. The first example was chosen at random. Example 1: Using 6 points: (0, -5) (0.2, 0) (0.2, 0.1) (0.5, 1) (0.52, -0.1) (1,8) Works in both Vandermonde and Lagrange We then [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=110&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">In an attempt to find examples that can cause the Vandermonde method or Lagrange method to fail, Katie and I made up various examples. The first example was chosen at random.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 1:</em></p>
<p class="MsoNormal">Using 6 points: (0, -5) (0.2, 0) (0.2, 0.1) (0.5, 1) (0.52, -0.1) (1,8)</p>
<p class="MsoNormal">Works in both Vandermonde and Lagrange</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">We then decided to try to make the interval between points smaller.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 2:</em></p>
<p class="MsoNormal">Using 4 points: (0,0) (0.001, 0.005) (0.002, 0.004) (0.005, -0.001)</p>
<p class="MsoNormal">Works in Vandermonde and Lagrange</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">In the previous example, we saw that there was no constant term. We thought this to be because the point (0,0) was chosen. Next, we decided to choose points that were very far apart.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 3:</em></p>
<p class="MsoNormal">Using 5 points: (-100, 89) (75, 200) (0,1) (1000,1000) (-20, 2)</p>
<p class="MsoNormal">Works in Vandermonde and Lagrange</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">After not being able to find any sort of error when choosing points that were close together then points that were far apart, we decided to try to choose points that had x values that were very close together and y values that were very far apart.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 4:</em></p>
<p class="MsoNormal">Using 3 points: (0.0001, 1000) (0.0002, -2) (0.0003, 200)</p>
<p class="MsoNormal">Worked in Vandermonde and Lagrange</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">Next, instead of working with points, we decided to use a specific function.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 5:</em></p>
<p class="MsoNormal">Y=cos(x) with 20 points chosen between -1 and 1</p>
<p class="MsoNormal">Works in Vandermonde and Lagrange</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">Since the cos function seemed to work efficiently in both methods, we thought to use the cos function of x to a negative power and add more points</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><em>Example 6: </em></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">n=50</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">x=linspace(-1,1,n)</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">Y=cos(x.^-1)</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">A=vander(x);</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">B=Y&#8217;;</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">Ax=B;</span><span style="font-family:Courier;"></span></p>
<p class="MsoNormal"><span style="font-family:Courier;color:black;">x=A\B</span></p>
<p class="MsoNormal">Result: Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">In the Lagrange method, it seemed to compute ok, but took a very long time.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">Overall, our results were inconclusive. We thought we may have found something that caused either one or both methods to fail (by putting x^-1) or increasing the amount of points but we were unable to find any concrete results.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=110&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/11/22/trying-to-break-either-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>
	</item>
		<item>
		<title>Polynomial interpolation</title>
		<link>http://aimeemarie88.wordpress.com/2008/11/11/polynomial-interpolation/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/11/11/polynomial-interpolation/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 21:13:11 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=105</guid>
		<description><![CDATA[When given various points in the x-y plane, the task to attempt to find a function that satisfies these points can sometimes be very difficult. One approach that can be taken uses the idea of the Vandermonde matrix and solving a linear system. Suppose the polynomial is of the form . A linear system of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=105&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">When given various points in the x-y plane, the task to attempt to find a function that satisfies these points can sometimes be very difficult. One approach that can be taken uses the idea of the Vandermonde matrix and solving a linear system.</span></span></p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">Suppose the polynomial is of the form <img src='http://s0.wp.com/latex.php?latex=p%28x%29%3Da_nx%5En%2Ba_%7Bn-1%7Dx%5E%7Bn-1%7D%2B...%2Ba_2x%5E2+%2B+a_1x%2Ba_0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x)=a_nx^n+a_{n-1}x^{n-1}+...+a_2x^2 + a_1x+a_0' title='p(x)=a_nx^n+a_{n-1}x^{n-1}+...+a_2x^2 + a_1x+a_0' class='latex' />. A linear system of the form Ax=B can be formed using the Vandermonde matrix of the points as A, the unknown coefficients as x, and the known function values as B.</span></span></p>
<p style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">A linear system of this form can be solved by hand using linear algebra, or much easier by using MATLAB. Taking the following example using data given in class:</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">A = vander(-1:0.5:1)</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">A =</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 1.0000   -1.0000    1.0000   -1.0000    1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0.0625   -0.1250    0.2500   -0.5000    1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0         0             0             0            1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0.0625    0.1250    0.2500    0.5000    1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 1.0000    1.0000    1.0000    1.0000    1.0000 </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">B=[0;-.5;-1;.75;-0]</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">B =</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> -0.5000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> -1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0.7500</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 0</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">x=A\B</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">x =</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> -4.6667</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> -1.6667</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 5.6667</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> 1.6667</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> -1.0000</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">This data shows the polynomial which satisfies these points is of the form:</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"><img src='http://s0.wp.com/latex.php?latex=p%28x%29%3D-%5Cfrac%7B14%7D%7B3%7Dx%5E4%2B%5Cfrac%7B5%7D%7B3%7Dx%5E3%2B%5Cfrac%7B17%7D%7B3%7Dx%5E2-%5Cfrac%7B5%7D%7B3%7Dx-1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x)=-&#92;frac{14}{3}x^4+&#92;frac{5}{3}x^3+&#92;frac{17}{3}x^2-&#92;frac{5}{3}x-1' title='p(x)=-&#92;frac{14}{3}x^4+&#92;frac{5}{3}x^3+&#92;frac{17}{3}x^2-&#92;frac{5}{3}x-1' class='latex' /></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">There is also another approach that can be used to find a polynomial which satisfies a set of points. This is known as Lagrange interpolation. Lagrange polynomials are interpolating polynomials which equal zero in at all points given, except one. For example: <img src='http://s0.wp.com/latex.php?latex=L_0%28x%29%3D%5Cfrac%7B%28x-x_1%29%28x-x_2%29%28x-x_3%29...%28x-x_n%29%7D%7B%28x_0-x_1%29%28x_0-x_2%29%28x_0-x_3%29...%28x_0-x_n%29%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='L_0(x)=&#92;frac{(x-x_1)(x-x_2)(x-x_3)...(x-x_n)}{(x_0-x_1)(x_0-x_2)(x_0-x_3)...(x_0-x_n)}' title='L_0(x)=&#92;frac{(x-x_1)(x-x_2)(x-x_3)...(x-x_n)}{(x_0-x_1)(x_0-x_2)(x_0-x_3)...(x_0-x_n)}' class='latex' /> will equal one at <img src='http://s0.wp.com/latex.php?latex=L_0%28x_0%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='L_0(x_0)' title='L_0(x_0)' class='latex' /> and zero at <img src='http://s0.wp.com/latex.php?latex=%5Cforall+L_0%28x_j%29j%5Cne0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;forall L_0(x_j)j&#92;ne0' title='&#92;forall L_0(x_j)j&#92;ne0' class='latex' /></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">The polynomial interpolation can be defined as <img src='http://s0.wp.com/latex.php?latex=p%28x%29%3Dy_1L_1%28x%29%2By_2L_2%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p(x)=y_1L_1(x)+y_2L_2(x)' title='p(x)=y_1L_1(x)+y_2L_2(x)' class='latex' />…<img src='http://s0.wp.com/latex.php?latex=%2By_NL_N%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='+y_NL_N(x)' title='+y_NL_N(x)' class='latex' /></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">After computing the solution by hand, we received help with constructing the MATLAB code for the Lagrange interpolation and saw there were two different ways it could be done. The first used the code</span></span></p>
<p style="margin:0;">syms t L P</p>
<p class="MsoNormal" style="margin:0;">x=[-1, -1/2, 0, 1/2, 1]</p>
<p class="MsoNormal" style="margin:0;">L(1) = ((t-x(2))*(t-x(3))*(t-x(4))*(t-x(5)))/((x(1)-x(2))*(x(1)-x(3))*(x(1)-x(4))*(x(1)-x(5)))</p>
<p class="MsoNormal" style="margin:0;">L(2) = ((t-x(1))*(t-x(3))*(t-x(4))*(t-x(5)))/((x(2)-x(1))*(x(2)-x(3))*(x(2)-x(4))*(x(2)-x(5)))</p>
<p class="MsoNormal" style="margin:0;">L(3) = ((t-x(2))*(t-x(1))*(t-x(4))*(t-x(5)))/((x(3)-x(2))*(x(3)-x(1))*(x(3)-x(4))*(x(3)-x(5)))</p>
<p class="MsoNormal" style="margin:0;">L(4) = ((t-x(2))*(t-x(3))*(t-x(1))*(t-x(5)))/((x(4)-x(2))*(x(4)-x(3))*(x(4)-x(1))*(x(4)-x(5)))</p>
<p class="MsoNormal" style="margin:0;">L(5) = ((t-x(2))*(t-x(3))*(t-x(4))*(t-x(1)))/((x(5)-x(2))*(x(5)-x(3))*(x(5)-x(4))*(x(5)-x(1)))</p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;">Y=[0; 3/4; -1; -1/2; 0]</p>
<p class="MsoNormal" style="margin:0;">P=L*Y</p>
<p class="MsoNormal" style="margin:0;">expand(P)</p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">We received the answer:</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">P =</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">-2*(t+1)*t*(t-1/2)*(t-1)-4*(t+1/2)*(t+1)*(t-1/2)*(t-1)+4/3*(t+1/2)*t*(t+1)*(t-1)</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">ans =</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">-14/3*t^4+5/3*t^3+17/3*t^2-5/3*t-1</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;">The second code, although more complex at first, will be better for future use.</span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;"><span style="color:#ff80c0;"> </span></span></p>
<p style="margin:0;">syms t L P</p>
<p class="MsoNormal" style="margin:0;">x=[-1, -1/2, 0, 1/2, 1];</p>
<p class="MsoNormal" style="margin:0;">Y=[0; 3/4; -1; -1/2; 0];</p>
<p class="MsoNormal" style="margin:0;">
<p style="margin:0;">for j=1:5</p>
<p class="MsoNormal" style="margin:0;">L(j)=1;</p>
<p style="margin:0;">for i=1:5</p>
<p style="margin:0;">if (i~=j)</p>
<p class="MsoNormal" style="margin:0;">L(j) = L(j)*(t-x(i))/(x(j)-x(i));</p>
<p style="margin:0;">end</p>
<p style="margin:0;">end</p>
<p class="MsoNormal" style="margin:0;">end</p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;">P=L*Y;</p>
<p class="MsoNormal" style="margin:0;">expand(P)</p>
<p class="MsoNormal" style="margin:0;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Courier;">ans =</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Courier;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Courier;">-14/3*t^4+5/3*t^3+17/3*t^2-5/3*t-1</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Courier;"> </span></p>
<p><span style="font-size:10pt;font-family:&quot;">It can be seen that both of these codes yield the same answer, which is also the same as the answer found using the Vandermonde matrix approach. The next step is to look more into these two approaches and find when one method will be more efficient than the other and whether or not both methods will work for all cases.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=105&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/11/11/polynomial-interpolation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>
	</item>
		<item>
		<title>Higher order iterations</title>
		<link>http://aimeemarie88.wordpress.com/2008/10/29/higher-order-iterations/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/10/29/higher-order-iterations/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 23:14:17 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=67</guid>
		<description><![CDATA[Introduction: After understanding that Newton’s method generally has second order convergence, I wondered if it was possible to have 3rd-order, 4th-order, or even nth order of convergence. A third order algorithm will triple the number of correct digits in each iteration. To find a third order iteration, one must attempt to determine an expression such [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=67&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">
<p class="MsoNormal"><strong>Introduction:</strong></p>
<p class="MsoNormal">After understanding that Newton’s method generally has second order convergence, I wondered if it was possible to have 3<sup>rd</sup>-order, 4<sup>th</sup>-order, or even nth order of convergence.</p>
<p class="MsoNormal">
<p class="MsoNormal">A third order algorithm will triple the number of correct digits in each iteration. To find a third order iteration, one must attempt to determine an expression <img src='http://s0.wp.com/latex.php?latex=q_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='q_n' title='q_n' class='latex' /> such that <img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+-+%5Csqrt%7Bs%7D+%3D+%5Cfrac%7B%28x_n-%5Csqrt%7Bs%7D%29%5E3%7D%7Bq_n%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} - &#92;sqrt{s} = &#92;frac{(x_n-&#92;sqrt{s})^3}{q_n}' title='x_{n+1} - &#92;sqrt{s} = &#92;frac{(x_n-&#92;sqrt{s})^3}{q_n}' class='latex' /> will lead to the desired 3<sup>rd</sup>-order iterative formula. Reqriting as <img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+%3D+%5Cfrac%7Bx_n%5E3+%2B+3x_ns%7D%7Bq_n%7D+%2B+%281-%5Cfrac%7B3x_n%5E2+%2B+s%7D%7Bq_n%7D%29%5Csqrt%7Bs%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} = &#92;frac{x_n^3 + 3x_ns}{q_n} + (1-&#92;frac{3x_n^2 + s}{q_n})&#92;sqrt{s}' title='x_{n+1} = &#92;frac{x_n^3 + 3x_ns}{q_n} + (1-&#92;frac{3x_n^2 + s}{q_n})&#92;sqrt{s}' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">The choice of letting <img src='http://s0.wp.com/latex.php?latex=q_n+%3D+3x_n%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='q_n = 3x_n^2' title='q_n = 3x_n^2' class='latex' /> will eliminate <img src='http://s0.wp.com/latex.php?latex=%5Csqrt%7Bs%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;sqrt{s}' title='&#92;sqrt{s}' class='latex' /> from the formula, which is required.</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Iteration formula:</strong></p>
<p class="MsoNormal">This yields the third-order formula <img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+%3D+x_n%28%5Cfrac%7Bx_n%5E2+%2B+3s%7D%7B3x_n%5E2+%2B+s%7D%29+&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} = x_n(&#92;frac{x_n^2 + 3s}{3x_n^2 + s}) ' title='x_{n+1} = x_n(&#92;frac{x_n^2 + 3s}{3x_n^2 + s}) ' class='latex' /> which has the property <img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+-+%5Csqrt%7Bs%7D+%3D+%5Cfrac%7B%28x_n-%5Csqrt%7Bs%7D%29%5E3%7D%7B3x_n%5E2+%2B+s%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} - &#92;sqrt{s} = &#92;frac{(x_n-&#92;sqrt{s})^3}{3x_n^2 + s}' title='x_{n+1} - &#92;sqrt{s} = &#92;frac{(x_n-&#92;sqrt{s})^3}{3x_n^2 + s}' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">In all cases of third order iterations, <img src='http://s0.wp.com/latex.php?latex=%7Cx_%7Bn%2B1%7D+-+%5Csqrt%7Bs%7D%7C+%3D+%5Cfrac%7B%7Cx_n+-+%5Csqrt%7Bs%7D%7C%5E3%7D%7B3x_n%5E2+%2B+s%7D%5Cle+%5Cfrac%7B1%7D%7Bs%7D%7Cx_n+-+%5Csqrt%7Bs%7D%7C%5E3&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|x_{n+1} - &#92;sqrt{s}| = &#92;frac{|x_n - &#92;sqrt{s}|^3}{3x_n^2 + s}&#92;le &#92;frac{1}{s}|x_n - &#92;sqrt{s}|^3' title='|x_{n+1} - &#92;sqrt{s}| = &#92;frac{|x_n - &#92;sqrt{s}|^3}{3x_n^2 + s}&#92;le &#92;frac{1}{s}|x_n - &#92;sqrt{s}|^3' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">Since <img src='http://s0.wp.com/latex.php?latex=%5Csqrt%7Bs%7D+%5Cge+1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;sqrt{s} &#92;ge 1' title='&#92;sqrt{s} &#92;ge 1' class='latex' />, the typical third-order behavior is <img src='http://s0.wp.com/latex.php?latex=%7Cx_%7Bn%2B1%7D+-+%5Csqrt%7Bs%7D%7C+%5Cle+%7Cx_n+-+%5Csqrt%7Bs%7D%7C%5E3&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|x_{n+1} - &#92;sqrt{s}| &#92;le |x_n - &#92;sqrt{s}|^3' title='|x_{n+1} - &#92;sqrt{s}| &#92;le |x_n - &#92;sqrt{s}|^3' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Example:</strong></p>
<p class="MsoNormal">Using this third-order formula to estimate radical 2 with the following MATLAB code:</p>
<pre>x(1)=1.0;
for i=1 : 6
    x(i+1) = sqrt(2) + ((x(i)-sqrt(2))^3)/(3*((x(i)))^2 +2)
end

x =
  Columns 1 through 3
   1.000000000000000   1.400000000000000   1.414213197969543
 Columns 4 through 6
   1.414213562373095   1.414213562373095   1.414213562373095
 Column 7
   1.414213562373095

<span style="font-size:12pt;font-family:&quot;">
</span><span style="font-size:12pt;font-family:&quot;">Graphing the error,

</span><a href="http://aimeemarie88.files.wordpress.com/2008/10/error-graph-3rd-order.jpg"><img class="alignnone size-full wp-image-71" title="error-graph-3rd-order" src="http://aimeemarie88.files.wordpress.com/2008/10/error-graph-3rd-order.jpg?w=480&#038;h=480" alt="" width="480" height="480" /></a></pre>
<p class="MsoNormal"><!--[if gte vml 1]&gt;                    &lt;![endif]--><!--[if !vml]--><!--[endif]--></p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Halley’s method:</strong></p>
<p class="MsoNormal">The method of convergence with higher order than Newton’s method that is often looked at is Halley’s method. Halley is most famous for analyzing the orbit of the comet in 1682 and making the correct prediction of its return 76 years later.</p>
<p class="MsoNormal">
<p class="MsoNormal">This method uses the quadratic term of the taylor series expansion of f and requires that the second derivative is continuous.</p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1}' title='x_{n+1}' class='latex' /> is defined as the route of the quadratic expansion:</p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=0+%3D+f%28x_n%29+%2B+%28x-x_n%29f%27%28x_n%29+%2B+%5Cfrac%7B1%7D%7B2%7D%28x-x_n%29%5E2f%27%27%28x_n%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='0 = f(x_n) + (x-x_n)f&#039;(x_n) + &#92;frac{1}{2}(x-x_n)^2f&#039;&#039;(x_n)' title='0 = f(x_n) + (x-x_n)f&#039;(x_n) + &#92;frac{1}{2}(x-x_n)^2f&#039;&#039;(x_n)' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">Each iteration would be of the form</p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+%3D+x_n+-+%5Cfrac%7B2f%28x_n%29%7D%7Bf%27%28x_n%29+%5Cpm%5Csqrt%7B%7Cf%27%28x_n%29%7C%5E2+-+2f%28x_n%29f%27%27%28x_n%29%7D%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} = x_n - &#92;frac{2f(x_n)}{f&#039;(x_n) &#92;pm&#92;sqrt{|f&#039;(x_n)|^2 - 2f(x_n)f&#039;&#039;(x_n)}}' title='x_{n+1} = x_n - &#92;frac{2f(x_n)}{f&#039;(x_n) &#92;pm&#92;sqrt{|f&#039;(x_n)|^2 - 2f(x_n)f&#039;&#039;(x_n)}}' class='latex' /></p>
<p class="MsoNormal">Since there are two signs in the denominator, the sign is chosen to try to minimize the difference between <img src='http://s0.wp.com/latex.php?latex=x_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_n' title='x_n' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1}' title='x_{n+1}' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">The order of convergence of Halley’s method is three. Again, Halley’s function involves the evaluation of the second derivative and each iteration requires three function evaluations.</p>
<p class="MsoNormal"><strong> </strong></p>
<p class="MsoNormal"><strong>Thoughts:</strong></p>
<p class="MsoNormal">It seems as though the third-order iteration formula appears to converge faster than the second-order formula and is in turn more efficient. Fewer iterations are needed to obtain the same accuracy. However, the third-order formula is much more complex than previous iteration formulas, almost entirely cancelling out its positives. In actuality, as the order of convergence increases, the complexity of the computation of derivatives, as well as increasingly large formulas, make the benefits of these higher order iteration methods not worth the trouble.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=67&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/10/29/higher-order-iterations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/10/error-graph-3rd-order.jpg" medium="image">
			<media:title type="html">error-graph-3rd-order</media:title>
		</media:content>
	</item>
		<item>
		<title>Newton</title>
		<link>http://aimeemarie88.wordpress.com/2008/10/29/newton/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/10/29/newton/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 23:00:09 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=65</guid>
		<description><![CDATA[Introduction: Newton’s method is generally of second order convergence. The number of correct digits will double with each iteration. Newton’s method is of the form: There are some points that are necessary in order to ensure convergence of Newton’s method: The derivative must be calculated directly, not approximated by using two points and finding the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=65&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><strong>Introduction: </strong></p>
<p class="MsoNormal">
<p class="MsoNormal">Newton’s method is generally of second order convergence. The number of correct digits will double with each iteration. Newton’s method is of the form:</p>
<p class="MsoNormal">
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=x_%7Bn%2B1%7D+%3D+x_n+-+%5Cfrac%7Bf%28x_n%29%7D%7Bf%27%28x_n%29%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x_{n+1} = x_n - &#92;frac{f(x_n)}{f&#039;(x_n)}' title='x_{n+1} = x_n - &#92;frac{f(x_n)}{f&#039;(x_n)}' class='latex' /></p>
<p class="MsoNormal">
<p class="MsoNormal">There are some points that are necessary in order to ensure convergence of Newton’s method:</p>
<ul style="margin-top:0;" type="circle">
<li class="MsoNormal">The      derivative must be calculated directly, not approximated by using two      points and finding the slope.</li>
<li class="MsoNormal">The      initial point chosen must be sufficiently close to the actual root, if it      is not fairly close, the method could diverge.</li>
<li class="MsoNormal">The      root must be a simple root, or of multiplicity one. If it is not, Newton’s method will      be no faster than the bisection method would be.</li>
</ul>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Kantorovich?:</strong></p>
<p class="MsoNormal">
<p class="MsoNormal">I wanted to look more into trying to find out if there was some sort of theorem or information that determines how close the initial guess must be to the actual root for Newton’s method to converge. It is clear that if any of the iterations of Newton’s method require a tangent line that is horizontal, the algorithm will not converge. I also found that the Kantorovich theorem can be used to describe this, however when looking more into it, I couldn’t really understand it.</p>
<p class="MsoNormal">
<p class="MsoNormal"><strong>Rate of Convergence of Newton’s Method:</strong></p>
<p class="MsoNormal">
<p class="MsoNormal">To find the rate of convergence of Newton’s method:</p>
<ul style="margin-top:0;" type="disc">
<li class="MsoNormal">Assume      that <img src='http://s0.wp.com/latex.php?latex=p_n+&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p_n ' title='p_n ' class='latex' /><em> </em>converges to<em> </em><img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' /></li>
<li class="MsoNormal">Set  <img src='http://s0.wp.com/latex.php?latex=E_n+%3D+p+-+p_n&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='E_n = p - p_n' title='E_n = p - p_n' class='latex' /> <em> </em>for  <img src='http://s0.wp.com/latex.php?latex=n+%5Cge+0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='n &#92;ge 0' title='n &#92;ge 0' class='latex' /></li>
<li class="MsoNormal">Let two      positive constants <img src='http://s0.wp.com/latex.php?latex=A+%5Cne+0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='A &#92;ne 0' title='A &#92;ne 0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=R+%3E+0+&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='R &gt; 0 ' title='R &gt; 0 ' class='latex' /> exist</li>
<li class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=%5Cmathop%7B%5Clim%7D%5Climits_%7Bn++++++%5Cto+%5Cinfty%7D%5Cfrac%7B%7Cp-p_%7Bn%2B1%7D%7C%7D%7B%7Cp-p_n%7C%5ER%7D+%3D+%5Cmathop%7B%5Clim%7D%5Climits_%7Bn+%5Cto++++++%5Cinfty%7D+%5Cfrac%7B%7CE_%7Bn%2B1%7D%7C%7D%7B%7CE_n%7C%5ER%7D+%3D+A&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;mathop{&#92;lim}&#92;limits_{n      &#92;to &#92;infty}&#92;frac{|p-p_{n+1}|}{|p-p_n|^R} = &#92;mathop{&#92;lim}&#92;limits_{n &#92;to      &#92;infty} &#92;frac{|E_{n+1}|}{|E_n|^R} = A' title='&#92;mathop{&#92;lim}&#92;limits_{n      &#92;to &#92;infty}&#92;frac{|p-p_{n+1}|}{|p-p_n|^R} = &#92;mathop{&#92;lim}&#92;limits_{n &#92;to      &#92;infty} &#92;frac{|E_{n+1}|}{|E_n|^R} = A' class='latex' /></li>
<li class="MsoNormal">The      sequence converges to <img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' /> with <span>order of convergence <img src='http://s0.wp.com/latex.php?latex=R&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='R' title='R' class='latex' /></span><em>.</em></li>
<li class="MsoNormal">The      number <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='A' title='A' class='latex' /> is called the <span>asymptotic error constant</span></li>
<li class="MsoNormal"><span>If $latexR=1$, there is linear      convergence </span></li>
<li class="MsoNormal"><span>If <img src='http://s0.wp.com/latex.php?latex=R%3D2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='R=2' title='R=2' class='latex' />, there will be quadratic      convergence</span></li>
</ul>
<p class="MsoNormal"><span style="color:black;"> </span></p>
<p class="MsoNormal"><strong><span style="color:black;">Simple Root versus Multiple Root:</span></strong></p>
<p>Assume that Newton-Raphson iteration produces a sequence  <img src='http://s0.wp.com/latex.php?latex=%7B%7Bp_k%7D%7D_%7Bk%3D0%7D%5E%5Cinfty+&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='{{p_k}}_{k=0}^&#92;infty ' title='{{p_k}}_{k=0}^&#92;infty ' class='latex' /> that converges to the root <img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' /><em> </em>of the function <img src='http://s0.wp.com/latex.php?latex=f%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)' title='f(x)' class='latex' /><span style="font-size:10pt;"><br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--></span></p>
<p><span style="font-size:10pt;"><span> </span></span><span style="text-decoration:underline;">Simple Root</span>: Convergence is quadratic and <img src='http://s0.wp.com/latex.php?latex=%7CE_%7Bk%2B1%7D%7C%5Capprox+%5Cfrac%7B%7Cf%27%27%28p%29%7C%7D%7B2%7Cf%27%28p%29%7C%7D%28%7CE_k%7C%29%5E2++&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|E_{k+1}|&#92;approx &#92;frac{|f&#039;&#039;(p)|}{2|f&#039;(p)|}(|E_k|)^2  ' title='|E_{k+1}|&#92;approx &#92;frac{|f&#039;&#039;(p)|}{2|f&#039;(p)|}(|E_k|)^2  ' class='latex' /></p>
<p style="margin-left:.5in;text-indent:6pt;">for  k  sufficiently large.<br />
<span style="font-size:10pt;"><br />
</span><span style="text-decoration:underline;">Multiple root of order m:</span> Convergence is linear and</p>
<p style="margin-left:.5in;text-indent:6pt;"><img src='http://s0.wp.com/latex.php?latex=%7CE_%7Bk%2B1%7D%7C+%5Capprox%5Cfrac%7Bm-1%7D%7Bm%7D%7CE_k%7C++&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|E_{k+1}| &#92;approx&#92;frac{m-1}{m}|E_k|  ' title='|E_{k+1}| &#92;approx&#92;frac{m-1}{m}|E_k|  ' class='latex' /></p>
<p style="margin-left:.5in;text-indent:6pt;"><span> </span>for  k  sufficiently large.</p>
<p><strong>Proof of Order of Convergence:</strong></p>
<p>Expand the Taylor polynomial of degree n=1 around the point x=p<sub>k</sub></p>
<p><img src='http://s0.wp.com/latex.php?latex=f%28x%29+%3D+f%28p_k%29+%2B+f%27%28p_k%29%28x-p_k%29+%2B+%5Cfrac%7B1%7D%7B2%21%7Df%27%27%28c_k%29%28x-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x) = f(p_k) + f&#039;(p_k)(x-p_k) + &#92;frac{1}{2!}f&#039;&#039;(c_k)(x-p_k)^2' title='f(x) = f(p_k) + f&#039;(p_k)(x-p_k) + &#92;frac{1}{2!}f&#039;&#039;(c_k)(x-p_k)^2' class='latex' /></p>
<p>Since  <img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' />  is a zero of  <img src='http://s0.wp.com/latex.php?latex=f%28x%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(x)' title='f(x)' class='latex' />,  let  <img src='http://s0.wp.com/latex.php?latex=x%3Dp&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x=p' title='x=p' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=0+%3D+f%28p_k%29+%2B+f%27%28p_k%29%28p-p_k%29+%2B+%5Cfrac%7B1%7D%7B2%21%7Df%27%27%28c_k%29%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='0 = f(p_k) + f&#039;(p_k)(p-p_k) + &#92;frac{1}{2!}f&#039;&#039;(c_k)(p-p_k)^2' title='0 = f(p_k) + f&#039;(p_k)(p-p_k) + &#92;frac{1}{2!}f&#039;&#039;(c_k)(p-p_k)^2' class='latex' />         .</p>
<p>With some rearranging,</p>
<p><img src='http://s0.wp.com/latex.php?latex=f%28p_k%29+%2B+f%27%28p_k%29%28p-p_k%29+%3D+-%5Cfrac%7Bf%27%27%28c_k%29%7D%7B2%21%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f(p_k) + f&#039;(p_k)(p-p_k) = -&#92;frac{f&#039;&#039;(c_k)}{2!}(p-p_k)^2' title='f(p_k) + f&#039;(p_k)(p-p_k) = -&#92;frac{f&#039;&#039;(c_k)}{2!}(p-p_k)^2' class='latex' />         .</p>
<p>Assuming that <img src='http://s0.wp.com/latex.php?latex=f%27%28x%29+%5Cne+0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;(x) &#92;ne 0' title='f&#039;(x) &#92;ne 0' class='latex' /> for all <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x' title='x' class='latex' /> near <img src='http://s0.wp.com/latex.php?latex=p&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p' title='p' class='latex' /></p>
<p>Since <img src='http://s0.wp.com/latex.php?latex=f%27%28p_k%29+%5Cne+0&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;(p_k) &#92;ne 0' title='f&#039;(p_k) &#92;ne 0' class='latex' />, you can divide by it</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bf%28p_k%29%7D%7Bf%27%28p_k%29%7D+%2B+%5Cfrac%7Bf%27%28p_k%29%7D%7Bf%27%28p_k%29%7D%28p-p_k%29+%3D+-%5Cfrac%7Bf%27%27%28c_k%29%7D%7B2f%27%28p_k%29%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;frac{f(p_k)}{f&#039;(p_k)} + &#92;frac{f&#039;(p_k)}{f&#039;(p_k)}(p-p_k) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' title='&#92;frac{f(p_k)}{f&#039;(p_k)} + &#92;frac{f&#039;(p_k)}{f&#039;(p_k)}(p-p_k) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' class='latex' /></p>
<p>Since <img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bf%27%28p_k%29%7D%7Bf%27%28p_k%29%7D+%3D+1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;frac{f&#039;(p_k)}{f&#039;(p_k)} = 1' title='&#92;frac{f&#039;(p_k)}{f&#039;(p_k)} = 1' class='latex' /></p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7Bf%28p_k%29%7D%7Bf%27%28p_k%29%7D+%2B+%28p-p_k%29+%3D+%5Cfrac%7Bf%27%27%28c_k%29%7D%7B2f%27%28p_k%29%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;frac{f(p_k)}{f&#039;(p_k)} + (p-p_k) = &#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' title='&#92;frac{f(p_k)}{f&#039;(p_k)} + (p-p_k) = &#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' class='latex' /></p>
<p>Rearranging to</p>
<p><img src='http://s0.wp.com/latex.php?latex=p+-+%28p_k+-+%5Cfrac%7Bf%28p_k%29%7D%7Bf%27%28p_k%29%7D%29+%3D+-%5Cfrac%7Bf%27%27%28c_k%29%7D%7B2f%27%28p_k%29%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p - (p_k - &#92;frac{f(p_k)}{f&#039;(p_k)}) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' title='p - (p_k - &#92;frac{f(p_k)}{f&#039;(p_k)}) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' class='latex' /></p>
<p>Using the fact that the Newton iteration formula is <img src='http://s0.wp.com/latex.php?latex=p_%7Bk%2B1%7D+%3D+p_k+-+%5Cfrac%7Bf%28p_k%29%7D%7Bf%27%28p_k%29%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p_{k+1} = p_k - &#92;frac{f(p_k)}{f&#039;(p_k)}' title='p_{k+1} = p_k - &#92;frac{f(p_k)}{f&#039;(p_k)}' class='latex' /> and substituting:</p>
<p><img src='http://s0.wp.com/latex.php?latex=p-%28p_%7Bk%2B1%7D%29+%3D+-%5Cfrac%7Bf%27%27%28c_k%29%7D%7B2f%27%28p_k%29%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p-(p_{k+1}) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' title='p-(p_{k+1}) = -&#92;frac{f&#039;&#039;(c_k)}{2f&#039;(p_k)}(p-p_k)^2' class='latex' />.</p>
<p>Using <img src='http://s0.wp.com/latex.php?latex=f%27%28p_k%29+%5Capprox+f%27%28p%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;(p_k) &#92;approx f&#039;(p)' title='f&#039;(p_k) &#92;approx f&#039;(p)' class='latex' /> and <em><img src='http://s0.wp.com/latex.php?latex=f%27%27%28c_k%29+%5Capprox+f%27%27%28p%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='f&#039;&#039;(c_k) &#92;approx f&#039;&#039;(p)' title='f&#039;&#039;(c_k) &#92;approx f&#039;&#039;(p)' class='latex' /></em> when <img src='http://s0.wp.com/latex.php?latex=k&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='k' title='k' class='latex' /> is sufficiently large<br />
<img src='http://s0.wp.com/latex.php?latex=p-%28p_%7Bk%2B1%7D%29+%5Capprox+-%5Cfrac%7Bf%27%27%28p%29%7D%7B2f%27%28p%29%7D%28p-p_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='p-(p_{k+1}) &#92;approx -&#92;frac{f&#039;&#039;(p)}{2f&#039;(p)}(p-p_k)^2' title='p-(p_{k+1}) &#92;approx -&#92;frac{f&#039;&#039;(p)}{2f&#039;(p)}(p-p_k)^2' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=E_%7Bk%2B1%7D+%5Capprox+-%5Cfrac%7Bf%27%27%28p%29%7D%7B2f%27%28p%29%7D%28E_k%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='E_{k+1} &#92;approx -&#92;frac{f&#039;&#039;(p)}{2f&#039;(p)}(E_k)^2' title='E_{k+1} &#92;approx -&#92;frac{f&#039;&#039;(p)}{2f&#039;(p)}(E_k)^2' class='latex' /></p>
<p>Taking the absolute values:</p>
<p><img src='http://s0.wp.com/latex.php?latex=%7CE_%7Bk%2B1%7D%7C+%5Capprox+-%5Cfrac%7B%7Cf%27%27%28p%29%7C%7D%7B%7C2f%27%28p%29%7C%7D%28%7CE_k%7C%29%5E2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='|E_{k+1}| &#92;approx -&#92;frac{|f&#039;&#039;(p)|}{|2f&#039;(p)|}(|E_k|)^2' title='|E_{k+1}| &#92;approx -&#92;frac{|f&#039;&#039;(p)|}{|2f&#039;(p)|}(|E_k|)^2' class='latex' /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=65&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/10/29/newton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>
	</item>
		<item>
		<title>Error of fixed point method</title>
		<link>http://aimeemarie88.wordpress.com/2008/10/26/error-of-fixed-point-method/</link>
		<comments>http://aimeemarie88.wordpress.com/2008/10/26/error-of-fixed-point-method/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 22:13:12 +0000</pubDate>
		<dc:creator>aimeemarie88</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aimeemarie88.wordpress.com/?p=58</guid>
		<description><![CDATA[One of the last things to do concerning fixed point methods was to take a look at the error produced with each iteration using the following code. x(1)=1.0; for i=1 : 7 x(i+1) = -sqrt(1/8)*(x(i)^2 &#8211; 2) + x(i) y=sqrt(2)-x(i+1) end Using the equation with radical two as the fixed point, starting with an initial [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=58&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">One of the last things to do concerning fixed point methods was to take a look at the error produced with each iteration using the following code.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;">x(1)=1.0;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:blue;">for</span><span style="font-size:10pt;font-family:Courier;color:black;"> i=1 : 7</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><span> </span>x(i+1) = -sqrt(1/8)*(x(i)^2 &#8211; 2) + x(i)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:black;"><span> </span>y=sqrt(2)-x(i+1)</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Courier;color:blue;">end</span></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">Using the equation with radical two as the fixed point, starting with an initial point of x<sub>0</sub>=1, and allowing the constant to equal the optimal constant, which is –sqrt(1/8), the following graph demonstrates how quickly the error decreases. After just six iterations, the root is found, with the error = 0.</p>
<p class="MsoNormal"><a href="http://aimeemarie88.files.wordpress.com/2008/10/errorjpg1.jpg"><img class="alignnone size-full wp-image-60" title="errorjpg1" src="http://aimeemarie88.files.wordpress.com/2008/10/errorjpg1.jpg?w=480" alt=""   /></a></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><!--[if gte vml 1]&gt;                    &lt;![endif]--><!--[if !vml]--><!--[endif]--></p>
<p class="MsoNormal">Regarding my previous post on types of convergence of the fixed point method, I would like to clarify some things. Let F’ be the derivative of the function and r be the actual root.</p>
<ul style="margin-top:0;" type="disc">
<li class="MsoNormal">If      |F’(r)|&lt;1, the iterations will converge, therefore the error will      decrease</li>
<li class="MsoNormal">If      |F’(r)|&gt;1, the iterations will diverge, therefore the error will      increase</li>
</ul>
<p class="MsoNormal">If there is convergence,</p>
<ul style="margin-top:0;" type="disc">
<li class="MsoNormal">The      error will decrease monotonically if 0 ≤ F’(r) &lt; 1</li>
<li class="MsoNormal">The      error will decrease in an oscillatory manner if -1 &lt; F’(r) &lt; 0</li>
</ul>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">I made up the following example which demonstrates this.</p>
<p class="MsoNormal">I designed the fixed point method, beginning at point x=0 to find the roots of following equation:</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--><em>x^<sup>2</sup> + x – 2 = 0</em></p>
<p class="MsoNormal"><em>x=</em><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B2%7D%7Bx%2B1%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;frac{2}{x+1}' title='&#92;frac{2}{x+1}' class='latex' /></p>
<p class="MsoNormal"><em>x<sub>n</sub>= </em><img src='http://s0.wp.com/latex.php?latex=%5Cfrac%7B2%7D%7Bxn+%2B1%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='&#92;frac{2}{xn +1}' title='&#92;frac{2}{xn +1}' class='latex' /></p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=G%28x%29+%3D+%5Cfrac%7B2%7D%7Bx%2B1%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='G(x) = &#92;frac{2}{x+1}' title='G(x) = &#92;frac{2}{x+1}' class='latex' /></p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=G%27%28x%29+%3D+%5Cfrac%7B-2%7D%7B%28x%2B1%29%5E2%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='G&#039;(x) = &#92;frac{-2}{(x+1)^2}' title='G&#039;(x) = &#92;frac{-2}{(x+1)^2}' class='latex' /></p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=G%27%281%29+%3D+%5Cfrac%7B-1%7D%7B2%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='G&#039;(1) = &#92;frac{-1}{2}' title='G&#039;(1) = &#92;frac{-1}{2}' class='latex' /></p>
<p class="MsoNormal"><img src='http://s0.wp.com/latex.php?latex=G%27%28-2%29+%3D+2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='G&#039;(-2) = 2' title='G&#039;(-2) = 2' class='latex' /></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">This shows that with the guess of an initial point sufficiently close to the root, it is expected that the iterations will converge to the root one in an oscillatory manner and will not converge to the root negative two.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal">The following MATLAB code confirms this:</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;">x(1) = 0;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">for</span><span style="font-size:10pt;font-family:&quot;color:black;"> i=1:30</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:black;"><span> </span>x(i+1)=2*(x(i)+1)^-1</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;color:blue;">end</span></p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;">Columns 1 through 12</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><span> </span>0<span> </span>2.0000<span> </span>0.6667<span> </span>1.2000<span> </span>0.9091<span> </span>1.0476<span> </span>0.9767<span> </span>1.0118<span> </span>0.9942<span> </span>1.0029<span> </span>0.9985<span> </span>1.0007</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><span> </span>Columns 13 through 24</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><span> </span>0.9996<span> </span>1.0002<span> </span>0.9999<span> </span>1.0000</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:&quot;"><!--[if !supportEmptyParas]--><!--[endif]--></span></p>
<p class="MsoNormal">This demonstrates the oscillatory convergence to the root one.</p>
<p class="MsoNormal">No matter which initial point is chosen, the code will not converge to the other root which is negative two. I attempted to chose negative three and negative one, but still both converge to the root one. This is appealing that the MATLAB code actually works and supports the data I previously found regarding types of convergence.</p>
<p class="MsoNormal"><!--[if !supportEmptyParas]--><!--[endif]--></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aimeemarie88.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aimeemarie88.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aimeemarie88.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aimeemarie88.wordpress.com&amp;blog=4707277&amp;post=58&amp;subd=aimeemarie88&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aimeemarie88.wordpress.com/2008/10/26/error-of-fixed-point-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2a25d558949791c3b70fde1b9aa540f1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aimeemarie88</media:title>
		</media:content>

		<media:content url="http://aimeemarie88.files.wordpress.com/2008/10/errorjpg1.jpg" medium="image">
			<media:title type="html">errorjpg1</media:title>
		</media:content>
	</item>
	</channel>
</rss>
