--- tags: mth302 --- # Miniproject 6 **Initial due date: Sunday, April 9 at 11:59pm ET** ## Overview This miniproject introduces a version of Euler's Method as a numerical solution technique for systems. **Prerequisites:** You will need to be comfortable with using Euler's method for single differential equations. You'll also benefit from some familiarity with spreadsheets or Python in order to automate the calculations. ## Background This tutorial gives you the background you need for this assignment. Please read it and make sure you understand the concepts and the example: https://github.com/RobertTalbert/linalg-diffeq/blob/main/assignments/Euler's_Method_for_Systems.ipynb ## Assignment 1. Consider the system $$\begin{align*} \frac{dx}{dt} &= -y \\ \frac{dy}{dt} &= x \end{align*}$$ You can show (but don't do it in your writeup) that $\mathbf{x}(t) = \begin{bmatrix} \cos(t) \\ \sin(t) \end{bmatrix}$ is a solution to this system. Its initial position is $\mathbf{x}(0) = [1,0]^T$ and returns to this position when $t = 2\pi$. In fact if you plot this in the phase plane, you'll see that the trajectory is a circle centered at the origin with radius 1. (a) Use Euler's Method with a step size of $0.5$ to approximate this solution from $t = 0$ to $t = 20$. This requires 39 different sets of calculations. Show *just the first* of these by hand, then use a computer or a spreadsheet to do the rest. (*Not* a calculator!) See the end of this assignment for instructions on how to submit your calculations. (b) Calculate the percent error in each of the calculations you made, compared with the theoretical solution $[\cos(t), \sin(t)]$ to see how far off your approximations are. Remember percent error is calculated by $\left| \dfrac{v_A - v_E}{v_E}\right| \cdot 100\%$ where $v_A$ is the approximate or observed value, and $v_E$ is the exact or expected value. Write 1-2 complete sentences summarizing what you see and then 1-2 more to explain why you think you are getting these results. (c) and (d): Repeat parts (a) and (b) except using a step size of $0.1$. This is now 199 calculations; again show the first one and then do the rest on a computer or spreadsheet. Don't forget the 2-4 sentences to write. (e) The points on the actual solution curve are all a distance of 1 from the origin. Is this true of the approximate solutions? Are they too far away from the origin, or too close? What will happen for other step sizes -- that is, will other approximate solutions using different step sizes be too far or too close to the origin? Write 2-4 sentences explaining what you think and why. 2. Use Euler's Method with a step size of $0.25$ to find the approximate value of the solution to the following system at $t = 1.25$: $$\begin{align*} \frac{dx}{dt} &= y + y^2 \\ \frac{dy}{dt} &= -x + \frac{y}{5} - xy + \frac{6y^2}{5} \end{align*}$$ given the initial condition $x(0) = 1, y(0) = 1$. Show one set of calculations, then do the rest in a computer or spreadsheet. ## Submission and Grading ### Formatting and special items for grading Miniproject 6 involves a significant amount of numerical calculations. The writeup you produce will be different from other Miniprojects, so read the following guidelines carefully. You may do your calculations for Euler's Method in one of two ways: 1. **Using a Google Sheet spreadsheet**. Whenever a part of a problem asks you to compute something (either Euler's Method computations or percent error computations), enter your work in an organized, easy-to-read way into your spreadsheet and do the computation using spreadsheet formulas. **You are not supposed to do every computation by hand separately!** You are supposed to use the functionality of a spreadsheet to set up a formula in a small number of cells and then apply it automatically (through dragging the formula) to other cells. If you go this route, *use a different tab for each part of each problem*. This would result in one spreadsheet with five tabs. Do not make five different spreadsheets, and do not put all the computations into a single tab on one spreadsheet. If you do either of these, your work will be marked *Incomplete* and returned without comment. When you are done with your spreadsheet, **set the permissions so that everyone with the link can comment** and then include the link in your writeup (see below). 2. **Using Python code inside a Colab notebook**. If you know some Python or are willing to learn, you may write code in a Colab notebook code cell that produces your computations automatically. As with spreadsheets *you are not supposed to do every computation by hand separately* -- the idea is to use code to automatically generate all the result you need on a particular part of a problem. If you write code, please note: **You may not use any `import` statements**, for example you may not import SciPy or NumPy; and **you must include an explanation for what your code is doing and why it works with each code cell you use**. If you import an external library like SymPy or NumPy, or if you give code with no explanation or an insufficient or irrelevant explanation, your work will be marked *Incomplete* and returned without comment. These problems typically also ask for written explanation and sometimes mathematical work that is not a spreadsheet or Python computation. If you are using a spreadsheet, you are allowed to use a document other than a Jupyter notebook (for example a Word document) to write these up. Then be sure to insert the link to your Google Sheet inside the document. If you are writing Python code, just put your written and math work in the Colab notebook with your code, like you usually do. Please note, no other spreadsheets (Excel, Numbers, etc.) are allowed. It has to be a Google Sheet. And, do not use a hand calculator! This would force you to perform roughly 300 different sets hand calculations separately if you did. Use Google Sheets or Python, nothing else. I do not typically look over student work to give feedback before it's submitted, but if you want to show me your work prior to submission to make sure it is *formatted* correctly, that's fine this time. Otherwise: Please review the section on Miniprojects in the document [Standards For Student Work in MTH 302](https://github.com/RobertTalbert/linalg-diffeq/blob/main/course-docs/standards-for-student-work.md#standards-for-miniprojects) before attempting to write up your submission. Note that *all* Miniprojects: - **Must be typewritten**. If any portion of the submission has handwritten work or drawings, it will be marked *Incomplete* and returned without further comment. - **Must represent a good-faith effort at a complete, correct, clearly communicated, and professionally presented solution.** Omissions, partial work, work that is poorly organized or sloppily presented, or work that has numerous errors will be marked *Incomplete* and returned without further comment. - **Must include clear verbal explanations of your work when indicated, not just math or code**. You can tell when verbal explanations are required because the problems say something like "Explain your reasoning". Your work here is being evaluated *partially* on whether your math and code are correct; but just as much on whether your reasoning is correct and clearly expressed. Make sure to pay close attention to both. And please review the requirements above for including your code. ### How to submit You will submit your work on Blackboard in the *Miniproject 6* folder under *Assignments > Miniprojects*. Then upload either your document of written and math work and the link to your Google Sheet; or a link to the Jupyter notebook you made.