<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>So the "point" of the fixed point exercise yesterday was to
demonstrate that you don't always have to <b>add</b> the argument
of the function to both sides of the equation to come up with a
fixed point method. In the problem yesterday you were asked to
solve</p>
<p><img
alt="$s(t)=s_0-\frac{mg}{k}t+\frac{m^2g}{k^2}\left(1-e^{-kt/m}\right)$"
style="vertical-align: middle;"
src="cid:part1.FDE3B809.FC7A8FBF@mercer.edu"></p>
<p>The solution to the problem is obviously when the burger hits the
ground, or <img alt="$s(t)=0$" style="vertical-align: middle;"
src="cid:part2.B051105F.763B3BBD@mercer.edu">. Noting that
fact, lets move the linear term in <img alt="$t$"
style="vertical-align: middle;"
src="cid:part3.942FCD8B.C5177DF9@mercer.edu"> to the other side
of the equation.</p>
<p><img
alt="$s_0+\frac{m^2g}{k^2}\left(1-e^{-kt/m}\right)=\frac{mg}{k}t$"
style="vertical-align: middle;"
src="cid:part4.3F5B105A.DA682C78@mercer.edu"></p>
<p>and then divide the left side of the equation by the coefficients
on the right....</p>
<p><img
alt="$\frac{s_0+\frac{m^2g}{k^2}\left(1-e^{-kt/m}\right)}{\frac{mg}{k}}=t$"
style="vertical-align: middle;"
src="cid:part5.E0CD9A91.CA2F2029@mercer.edu"></p>
<p>That should set up a fixed point algorithm for testing in python
which, starting at 0, converges to better than IEEE
single-precision tolerance in 10 iterations.</p>
<p><font size="+1"><tt>from math import exp</tt><tt><br>
</tt><tt><br>
</tt><tt>def s(t):</tt><tt><br>
</tt><tt> m = 0.25</tt><tt><br>
</tt><tt> k = 0.1</tt><tt><br>
</tt><tt> s0 = 300.0</tt><tt><br>
</tt><tt> g = 32.17</tt><tt><br>
</tt><tt> denom = m*g/k</tt><tt><br>
</tt><tt> coeff = m**2*g/k**2</tt><tt><br>
</tt><tt> exparg = k/m</tt><tt><br>
</tt><tt> return (s0+ coeff*(1-exp(-exparg*t)))/denom</tt><tt><br>
</tt><tt><br>
</tt><tt>t=0</tt><tt><br>
</tt><tt>for i in range(1,15):</tt><tt><br>
</tt><tt> print i, s(t)</tt><tt><br>
</tt><tt> t=s(t)</tt></font></p>
<p><br>
</p>
<p>here is the output...</p>
<p><b>rufus:/tmp %</b><tt> </tt><font size="+1"><tt>python
burger.py</tt><tt> </tt><tt><br>
</tt><tt>1 3.73018340068</tt><tt><br>
</tt><tt>2 5.6679187484</tt><tt><br>
</tt><tt>3 5.97117033386</tt><tt><br>
</tt><tt>4 6.00075801098</tt><tt><br>
</tt><tt>5 6.00345727224</tt><tt><br>
</tt><tt>6 6.00370193736</tt><tt><br>
</tt><tt>7 6.00372410112</tt><tt><br>
</tt><tt>8 6.00372610878</tt><tt><br>
</tt><tt>9 6.00372629064</tt><tt><br>
</tt><tt>10 6.00372630712</tt><tt><br>
</tt><tt>11 6.00372630861</tt><tt><br>
</tt><tt>12 6.00372630875</tt><tt><br>
</tt><tt>13 6.00372630876</tt><tt><br>
</tt><tt>14 6.00372630876</tt><tt><br>
</tt><tt>15 6.00372630876</tt></font><font face="Helvetica,
Arial, sans-serif"><br>
</font><br>
</p>
<p>Congratulations to Bret Wilson who sent the correct code in just
before class ended. Literally minutes behind Bret were Emily
Herron and Hannah Gulle who also both submitted correct code and
answers. Nicely done.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Andrew J. Pounds, Ph.D. (<a class="moz-txt-link-abbreviated" href="mailto:pounds_aj@mercer.edu">pounds_aj@mercer.edu</a>)
Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
<a class="moz-txt-link-freetext" href="http://faculty.mercer.edu/pounds_aj">http://faculty.mercer.edu/pounds_aj</a>
</pre>
</body>
</html>