## MAT 2680 Differential Equations - Reitz

### "...how it differs from the rocks"

This post contains additional information related to the Numerical Methods Project posted last week, due March 23rd.

Submission guidelines. Your completed project will consist of three elements:

1. A working numerical methods calculator using your choice of technology (spreadsheet, programming, mathematical software), as described in the previous post.
HOW TO SUBMIT:

• If your project is a spreadsheet, either share it with me (if it is in Google Docs or a similar cloud-based platform), or email the file to me as an attachment.
• If your project is code, please submit it using an online coding site like ideone.com – once your code is working on the site, you can simply submit a link.  If you are using a programming language not supported by ideone.com, you can email the source code to me.
• If your project uses mathematical software, either share it with me (if it is in MatLab Online or a similar cloud-based platform), or email the file to me as an attachment.
2. Solutions to the following example using each of the three methods studied in class (Euler’s Method, Improved Euler’s Method, and Runge-Kutta), generated by your numerical methods calculator.  Submit using the same method as in part 1.

Project Example.  Given the differential equation $dy/dx = \frac{xy}{x-y}$ and initial condition $y(6)=0.8$, approximate the value of $y(7.1)$ using Euler’s Method, Improved Euler’s Method, and Runge-Kutta.

For each method, choose a step size that gives four correct digits following the decimal point.  How many steps are required to obtain this level of precision?

NOTE: The actual solution is $y(7.1)=3.700936$

1. Writing assignment.  Write one or two paragraphs (minimum 300 words) responding to the following.  Leave your response as a comment on this post.
1. Describe your project and how it works.
2. Describe the process of building your numerical methods calculator.  What kind of technology did you decide to use, and why? Did you encounter any unexpected challenges in completing this project?
3. Why do we need numerical methods in addition to the other methods studied in the class?
4. Why is this assignment included in the class (instead of just computing the various methods using a calculator)?
5. Please include a link to your project (if it is online), or clearly state that you will be sending me the files by email (and don’t forget to do it!).

1. first, i need to solve the function on a paper to get the information i need to solve the function on excel or numerical methods calculator. The process of building the numerical method calculator was difficult for me since i don’t use excel that often. i chose to use excel on school’s computer because i do not have excel. There are many unexpected challenges in completing the project. Example, like the function command on excel and the tools on excel were difficult for me since i do not know where the command is located or what command are there. Numerical method is one of the most precise method that we can use to solve a problem in the class. The assignment could also taught ourselves to understand what other tools are available for us to solve numerical problems. I will send an email

• file too big, ill share with dropbox

• Dear Jacky,
Thanks for being first to post – looking forward to seeing your solution!
-Prof. Reitz

• Heads up – for full points, you should expand your answer to meet the 300 word minimum (I’ll accept a separate comment with a continuation of your thoughts if you wish).
Best,
Prof. Reitz

• first, i need to solve the function on a paper to get the information i need to solve the function on excel or numerical methods calculator. First, need to input all the required numbers and information and name them.the h is step size, x0 is x initial,y0 y initial, and xn x final use to calculate the y(x). Then, i set another column depending on each question. For example, euler i input x and y starting with the number provided on the question. For X i set the initial number and for the rest will be set by how many steps. For, Y i input the initial number after that i will create an equation on excel. The process of building the numerical method calculator was difficult for me since i don’t use excel that often. i chose to use excel on school’s computer because i do not have excel. I did do some online research about the excel. For example, the excel commands and how to input equations. There are many unexpected challenges in completing the project. Example, like the function command on excel and the tools on excel were difficult for me since i do not know where the command is located or what command are there. Numerical method is one of the most precise method that we can use to solve a problem in the class. The assignment could also taught ourselves to understand what other tools are available for us to solve numerical problems. Sometime, calculating a math problem is much more simpler and precise but it could be difficult depending on the math problem. Sometime we use numerical method with use of computers is because the steps that is required to solve the problem is much more difficult or many steps to solve the problem. I will share it with dropbox

2. I chose to do my project on excel because it’s basically the only program I know how to use. I could’ve have used MATLAB but I’m not really that good in writing functions. Anyways, the process of building a numerical methods calculator wasn’t too bad because in excel all you have to do is put the given information into the cells and then plug them in to the formula. After doing that, you find y_(i+1). The only challenging part of this project was finding the step size (h) because we had to find y(7.1)=3.00936… with a 4 decimal precision. We need numerical methods in addition to the other methods we’ve studied in class because numerical methods gives you a precise answer. It’ll give you an even more accurate reading if you’re using Improved Euler’s or Runge-Kutta methods. I believe that this assignment was included in the class because so we can have an understanding of, depending on the method one uses, how many steps it takes to get answer. Like if we have a small step size h, we will get a more precise answer where as a bigger step size h, will not be as precise, but of course, there’ll be a lot more steps to a smaller step size h. ..I shared my file on Google Docs and I emailed it to you as well.

3. For this project I decided to use a spreadsheet method for the calculation of Euler, Improved Euler and Runge-Katta. There is a column for each input that has been programmed to calculate the output of each criteria.
I used excel spreadsheets to build my numerical methods calculator because it is the most familiar option for me. One of the unexpected challenges that I faced during this project was figuring out the step size value. The second unexpected challenge was the amount of steps that had to be taken in order to get the final value within four decimal point accuracy. That unexpected challenge lead me to the realization that coding would have been a much better option and I should learn how to code one of these days.
We study different methods in class to help us decipher which method we should use when faced with a difficult equation. We need numerical methods in addition to the other methods we have studied to calculate the solutions (curves) that will produce answers that can help investigate different types of real life problems.
This assignment is included in the class because it creates a better understanding of numerical methods and it would take a very very very long time to complete this assignment by hand. The assignment also to shows us that there are other mediums beyond pen and paper that can be used to solve differential equations.
I have sent you my project Via email.

4. For this project I used Excel. The reason I decided to use Excel over MATlab is because I do not have MATlab on my computer and I did not feel like staying in the computer lab for the duration of this project.

My project works by plugging in you x, y, step size and a few other things in order to create an approximate answer for the differential equation that was given. I sat down and wrote out the code for each method using the formulas for each part that we got in class. I was really comfortable making the code but the hardest part was determining the step size. I kept on increasing the step size over and over and it was not giving me an accurate answer. I ended up making the step size incredibly small and slowly increasing it till I got the desired amount of decimals accurate (4 after the decimal point). I was really surprised at the difference in Step Size between each method with Euler’s method taking the most steps and the Runge- Kutta method taking SIGNIFICANTLY less steps. It really helped me to put in perspective how accurate each method is.

We need numerical methods in order to get accurate answers for Differential Equations that we can not solve with other methods we have learned in class. With numerical methods, any differential equation can be solved regardless on if you know how to solve it or not.

I believe this assignment is included in the class to help show us how powerful and accurate some of the numerical methods can be in inputting a small step size and producing an accurate answer. It was also put in the class to help better our understanding of each method and how they work,

I will be sending this project to you by email.

• Ryan, I really like your comment “I was really surprised at the difference in Step Size between each method with Euler’s method taking the most steps and the Runge- Kutta method taking SIGNIFICANTLY less steps.”

I admit, although I know that Runge-Kutta is more powerful, I didn’t really realize how much better it is until I completed this project myself (just before class, last Tuesday). I was surprised too!

5. My choice to create a spreadsheet, a code, or a program to evaluate Eulers method, improved Eulers, and Runge-Kutta was to create a spreadsheet. I chose to use Excel because i am a bit more familiar with it that creating a code or using any other mathematical software. I have three separate spreadsheet for each of the methods. Each spreadsheet is broken down into row and columns. Each column is labeled to represent each part each section of the numerical method. At the beginning of each spreadsheet i have a cell dedicated to h= which is my step size. My differential equation is denoted in a cell where it incorporates the other accompanied cells to carry out that specific equation. Also, line 0 in each of the methods is dedicated to the initial condition given. For example if my differential equation is y’=x+y and my step size is 0.25 and the initial condition is y(0)= 1, then all i have to do is change the h in my spreadsheet and input the values for the initial condition and also the differential equation. Upon entering those values each cell will automatically change according to the resected numbers. Challenges i faced in creating these spreadsheets were getting all the cells to work properly together. Any small error can throw your numbers off or just simply return an error code back. This became especially true when it came to Improved Eulers method and Runge_Kutta methods.

We use numerical methods to give us an approximation of a certain point over time or distance. This approximation can be fairly accurate depending on which method you use and how small of a step size you use. The bigger the step size the less accurate your answers will be and vice versa. This assignment is included in the class because sometimes we may not have access to such computer programs that run these methods or a code; we can simply pull up our spreadsheet and calculate these results. Another reason may be that you are asked to find step 100 of that specific differential equation. To write out all those calculations by hand will take a very long time, and as time goes on human error can kick in because of fatigue or just simply overlooking a step.

Prof. i have emailed you my spreadsheets.

6. For my Numerical Methods calculator project, I decided to use Microsoft Excel. I chose to use Excel because I am not too familiar with MATLAB or creating a calculator with a programming language. For my Numerical Methods calculator, I created 3 sheets in Excel, consisting of Euler’s method, Improved Euler’s method and the Runge Kutta method. For each of the numerical methods in Microsoft Excel, I created a column for the formulas that were I needed. Some of the formulas for the calculator consisted of finding the f(x,y), y(i+1), z and k values. After creating my columns, I could then create formulas for the first row of each of the components that I was looking for by referencing the cells that corresponded to the formula. To help me see if I was on the right track with some of the formulas, I wrote out the formula and used a calculator and that would give me an indication that I typed the formulas correctly.

At the beginning of this project, I had ran into a few challenges with referencing the cells. To get a good idea of how the cells and equations worked in the Excel spreadsheet, I practiced the first example problem. After completing the first example problem, I worked on the second example problem. Initially, I thought that for each row, I had to type the formulas to get to the values. I soon learned that once my first row was filled with formulas, Excel could generate the values automatically for the following rows for each of the numerical methods. While I practiced the problems, I also began to realize how some of the cells were needed to generate values for other cells like the y(i+1) column. One of the other challenges that I had also ran into was guessing the step size, especially for Euler’s method since we needed to specifically generate a value of 3.7009 with the 4-decimal accuracy.

I believe this assignment is included in the class because it helps to give us a better understanding of how accuracy and precision works. I also see that we’re able to use the slope to help with generating the next y and y(i+1) values. Working on the numerical methods calculator in Microsoft Excel helped me to see and understand how only a few steps are required to find the y value, as opposed to Euler’s method which consisted of many more steps that were needed to find the y value. For the two problems, I saw how it was easy to guess a step size of the Runge Kutta method but it was difficult to guess the step size for Euler’s method. The less precise the method, the lower the step size will be which will help with finding the specific y value for each of the methods. The way I see it, if the same step size is being used for each of the numerical methods, the Runge Kutta method will be the most accurate, giving the precise or exact value that you’re looking for. The Improved Euler’s method is not as accurate as Euler’s, giving a slightly less accurate value. Euler’s method is the least accurate method but will give you a good indication that your approaching the value that you’re looking for. If the step size is altered for each case, then it is definitely possible to get the y value that is needed for each method but the amount of steps will vary for each method.

I will be sending my project by email.

• Despite the raw computing power of other platforms, I have always liked Excel and other spreadsheets because of their flexibility – they do a good job of taking your ideas and generalizing them (once you know the basics). Your description of working with them resonated with me!

7. For my Numerical Methods Project, I decided to use excel. I made three different excel spreadsheets, one for each method. The way each spreadsheet is set up, I will begin with an initial x and y value called x_i and y_i. For all three methods I used a step size of 0.1. Euler’s Method was the simplest to do since it only required two formulas. One formula calculated k and the other calculated y_(i+1). Euler’s Improved Method was a little more complicated because it involved more formulas. Using the initial x values and the step size of 0.1, I was able to find all x values needed until I reached 7.1. We were also were given an initial y value. Next step was to find k1. Using the given differential equation, I plugged in the x and y values to determine k1. I then found my z_(i+1) value, since I found the corresponding k1 value. Using the z_(i+1) value I next found k2 and using k2, I finally was able to find my y_(i+1) value or the next y value until I find the y value that corresponds to the x value of 7.1. From all three, Runge-Kutta was the most complicated. This method incorporated many more steps compared to the other two methods. For this method I used some similar formulas from the improved Euler’s method spreadsheet and calculated k1, k2, k3, and k4. To make it easier for me, I calculated z_1, z_2, z_3, and z_4 as well. This just helped me simplify the formulas for k1-k4. Finally, I was able to find y_(i+1) by incorporating the formula that averaged out all my k values found. This formula was given to us in class. Overall, this assignment wasn’t too hard. All it takes is understanding the formulas and being organized.
I used excel for my project because it seemed like the easiest way to include all three methods. I soon realized it wasn’t as easy as I thought. It took a little of researching and knowing how to use the formulas for each method as well as knowing where to place them in the excel spreadsheet. It also took a lot of trouble shooting to finally get the spreadsheets to work. Testing each formula before moving to the next one was key to making this project run smoother for me. I originally was able to use the first example given on Openlab to create all three methods. Once I saw my numbers equaled those given on the solution I moved on to the second example. We need numerical methods because it is an extremely powerful problem-solving tool. It allows us the ability to use large systems of equations and solve complicated equations as well, specifically differential equations for this class.
I believe this assignment was included in our class to help us understand each numerical method better. It’s one thing just putting numbers into a calculator but it’s another thing getting an entire spreadsheet or program to work. It takes knowing each of the different formulas to complete this assignment. I also believe this assignment was included in our class because most of the students in our class are majoring in computers and we were given the chance to incorporate our knowledge upon our field of study into this class. I will be sending my project to you via e-mail.

• David, your explanation of the development process if very clear – thank you. You say “All it takes is understanding the formulas and being organized”, but these are not at all easy – good job!

8. For my project I will be using the program Matlab and write a code in four different files which need to be put together to run the code to provide the needed outputs. If it is possible for me to implement the code in one file I will send it as such, but so far it only works when it’s in separate .m files. The reason why I choose Matlab because out of the other coding formats I believe doing it in Matlab is easier and needs a lot less lines of code, Matlab provides a less complicated compiler as well. Building the program became complicated only when I tried to do everything from the same script file, I’m currently still trying to develop a way to do everything from the same script file even after I turn it in. I included step by step messages into the code so each line has its own explanation so I don’t have to explain it line by line here. The biggest problem that I came across building the program dealt mostly with tiny errors here and there. Misplaced periods, and semicolons giving errors when the programed was compiled. It’s very easy to make a tiny mistake when using Matlab because unlike C++ and other programming languages Matlab is very specific, if you do not write it exactly how its suppose to be it won’t be able to correct the error itself. The purpose for additional methods is to give better approximations when presented with different problems, so one method might provide an easier path while another would take longer both giving either further or closer approximations depending on the step. I believe this assignment is included in this class to provide alternate hands on methods other than just a calculator to answer these complex problems. Just like the methods themselves it’s good to know multiple ways to solve a problem, and multiple ways to implement different strategies of using the methods themselves.

• Cody, I have only limited experience with Matlab development – I’m looking forward to seeing your project. Your final comment “Just like the methods themselves it’s good to know multiple ways to solve a problem, and multiple ways to implement different strategies of using the methods themselves” is spot on – for future engineers, I think this is one of the primary takeaways from this course.

Theme by Anders NorenUp ↑