%Convergence of Euler Methods %If you modify this file, please indicate here and in the footnote %Math340 \documentclass[12pt]{article} \usepackage{times} \pagestyle{empty} %\topmargin -.2in \headheight 0in \addtolength{\textwidth}{1.0in} \addtolength{\textheight}{1.0in} \addtolength{\oddsidemargin}{-.5in} \addtolength{\evensidemargin}{-.5in} \renewcommand{\baselinestretch}{1.0} \parindent = 0cm \parskip = .1cm \begin{document} \begin{center} \Large Convergence of Euler Methods \footnote{Copyright \copyright 2004 Todd Young. All rights reserved. Please address comments to young@math.ohiou.edu.} %modified by ~~~~} \end{center} \begin{enumerate} \item Download the file \verb&myeuler.m& from the class web site and save it in your working directory as \verb&myeuler.m&. \item Download the file \verb&mymodeuler.m& from the class web site and save it in your working directory as \verb&mymodpeuler.m&. \item Open \textsc{Matlab}. Open and read the two files you just saved. \item Type the following commands (at the prompt and then press \fbox{Enter}):\\ \verb& f = inline('sin(t)*cos(x)','t','x')&\\ \verb& myeuler(f,[0,12],.1,10) & (Euler method) \\ \verb& hold on&\\ \verb& myeuler(f,[0,12],.1,20) & (Use the up arrow.)\\ \verb& myeuler(f,[0,12],.1,30)&\\ From the comments in the program identify the meaning of each number in these commands. \item Position the plot window so that it can always be seen. Continue to increase the last number in the above until the graph stops changing (as far as you can see). Record this number and print the final graph. Type \verb&hold off& and kill the plot window. \item Next type:\\ \verb& mymodeuler(f,[0,12],.1,10) & (Modified Euler method)\\ \verb& hold on&\\ \verb& mymodeuler(f,[0,12],.1,20) & (Use the up arrow.)\\ \verb& mymodeuler(f,[0,12],.1,30)& \item Again continue to increase the last number in the above by 10s until the graph stops changing (as far as you can see). Record this number and print the graph. \item Prepare a brief (\verb$< $1 page) written report comparing the Euler and modified Euler methods. Use complete sentences and standard mathematical notation. \end{enumerate} \vfill \textsf{Students should observe that numerical solutions seem to converge as $n$ is increased ($h$ is decreased). This happens much faster for the modified Euler method than for the Euler method.} \end{document}
View Site in Mobile | Classic
Share by: