MAT 3353 Numerical Analysis, Fall 2019, T/Th 10:40-11:55, NSRC 103

Good Links

1. Course Syllabus

2. Miscellaneous Class Files (including copies of class example programs)

Links 3 and 4 for Windows users only!

3. Notetab++ - an excellent (free) editor for Windows systems for programming

4. ActivePython download link for Windows

Link 5 for Mac users only!

5. BBedit - an excellent (free) editor for Mac systems for programming

6. TextWrangler Text Editor - Mac users try this if BBedit won't install on your system

7. Homework Files

8. Example Files

9. Textbook for this semester

10. Source code for textbook
============================================================

Homework Assignments

HW0: Watch this Geno Auriemma link. (This is how I feel about engagement in this class!) ================================================================ HW1: Bring your computer with you on Wednesday! For Windows Computer Users: 1. Download and install the Notepad++ (version 7.7.1) from this link: ( choose the Notepad++ Installer 64-bit x64: Take this one if you have no idea which one you should take.) 2. Download Python 2 from this link: ( choose the Windows x86-64 MSI installer file) 3. Download Python 3 from this link: ( choose the Windows x86-64 executable installer file) For Mac Computer Users: 1. Download BBedit (the "Free Download") from this link::: We will install the software together in class on Wednesday. ================================================================ Remember to dress up pretty for class on Wednesday for my seating chart pictures! ================================================================ HW2: On your computer, start the terminal (linux/mac) or cmd (Windows) program, like we did in class on Wednesday. Type Python to start the Python Interpreter. This will give you the >>> prompt. Using this prompt, you can work through sections 1.51 (pg 12) - 1.54 (pg 14) in our text. Things will look a little different from the text since we are using the Python Interpreter to accomplish the same things. For example, on page 12, where the text has: In [1]: 2+2 Out [1]: 4 You will see: >>> 2+2 4 >>> (You type 2+2 and press 'Enter', the interpreter shows you the result of the command, which is 4. It then gives you another prompt for the next command). Try doing all the examples in 1.5.1 - 1.5.4 and we will continue in class on Wednesday! ================================================================ HW3: R&S (read and study) sections 1.1-1.3 (pgs 1-9) in our text. Make a copy of our ball.py program we worked with in class on Wednesday, name it hw3-ball.py Use your text editor and modify the program to produce the following output: Email your program to me in an email with the Subject Line: MAT3353, HW3 (Note: We did everything in class to where you should be comfortable with this assignment. However, if something is confusing you, or if you are having troubles, email me and ask questions!) Due: Start of class, Monday, 9/9 ================================================================ HW4: R&S sections 1.4-1.5.4 (pgs 9-14) in our text. Do Exercise 1.2 on pg 27. Name your program HW4-cube-volume.py Do Exercise 1.3 on pg 27. Name your program HW4-circumference-and-area.py Email your programs to me with the Subject Line: MAT3353, HW4 Due: Start of class, Wednesday, 9/11 ================================================================ HW5: R&S sections 1.5.5-1.5.11 (pgs 15-26) in our text. Do Exercise 1.4 on pg 27. Name your program dj-HW5-volume3cubes.py Do Exercise 1.5 on pg 27. Name your program dj-HW5-average-int.py (In all cases on the program name, substitute your own initials in place of dj) Email your programs to me with the Subject Line: MAT3353, HW5 Due: Start of class, Monday, 9/16 ================================================================ HW6: R&S sections 2.3-2.4 (pgs 37-41) in our text. This section shows how to use a sum variable to save a sum of numbers. You will use this technique, but with a while loop to write a program to do the following: Use input statements to get a starting integer and an ending integer. Then Use a while loop and your sum variable to find and then print the sum of these integers. For example, the sum of the integers from 1 to 100 is 5050. That is what your program should print. Here is an example of the output from my program: Due: Start of class, Wednesday, 9/18 ================================================================ HW7: R&S sections 2.1-2.2 (pgs 29-36) in our text. 1) Write a program to allow a user to give an input parameter (call it n) and have your program print the sum of the square root of all the integers from 1 to n. Name your program dj-HW7-square-root-sum.py (with your own initials, of course). Your program output should be similar to a sample run of my program, which looks like this: 2) Exercise 2.11 modified: Write a program to calculate the Leibnitz and Euler approximations to pi for a given value of n. The value of n should be given as a command line parameter. Just have your program print the value of n, the value of the Leibnitz approximation, and the value of the Euler approximation. You do NOT need to do the plotting given in the last paragraph of Exercise 2.11. Name your program dj-HW7-pi.py with your own initials, of course). Your program output should be similar to a sample run of my program, which looks like this: I would recommend that you don't wait too long to start on these. If you wait until just an hour before class, you may not have time to figure everything out! Feel free to email me questions if you get stuck on something. Email your programs to me with the Subject Line: MAT3353, HW7 Due: Start of class, Monday, 9/23 ================================================================ HW8: R&S sections 2.5-2.6 (pgs 41-44) in our text. Make a copy of our xy-chart-cls.py program from the 0918 examples worked in class. Name the copy dj-HW8-xy.py (use your own initials). Modify the program to use a function for y, instead of having the function "hard coded" in the while loop. Email your program to me with the Subject Line: MAT3353, HW8 Due: Start of class, Wednesday, 9/25 ================================================================ HW9: R&S sections 6.0 - 6.21 (pgs 184-193) in our text. 1) Make a copy of our xy-chart2.py (the one we used in class on Wednesday) and name it dj-hw9-xy-chart.py (use your own initials). Add a function to the program that will check to see that the command line parameters for xstart, xdelta, and xend all make sense. If they do not, print a message indicating so, and gracefully quit the program. Your output should be similar to mine here: 2) Use your brute-force-root-finder to find the roots for each of the following functions. After each one, email me a copy of your program, named dj-hw9-2a.py, for the first, and dj-hw9-2b.py for the second (use your own initials). a) f(x) = sin( e^x ) , find a root between 0 and 2. b) f(x) = e^(sin x) , find a root between 1 and 5. Due: Start of class, Monday, 9/30 ================================================================ HW10: 1) Make a copy of our modified_brute_force_root_finder_function.py from class today. Name it dj-hw10-brute-force-root-finder.py. Modify the program to use command line parameters to give the values of a, b, and n to the program. a is the starting point, b is the ending point, and n is the number of points for the x list in the linspace command. Using the same example we used in class today, you should run your program like this: python dj-hw10-brute-force-root-finder.py 0 4 1001 Your output should be similar to this: Email your program to me when you have it. 2) Use your program above to find all the roots to f(x) = sin(e^x) between 0 and 4. Pipe your output to a text file named hw10-output.txt. Email it to me with your program above using the Subject Line: MAT3353, HW10. Due: Start of class, Wednesday, 10/2 ================================================================ HW11: 1) Make a copy of our text-newtons-method-improved.py from class on Wednesday and name it dj-hw11-newton-root-finder.py. Modify the program to use command line inputs for the starting value of x, and the epsilon value. If you use the function x^2 - 9, your output should be similar to mine below: 2) Use your program to find the following roots: a) f(x) = x * cos(x^3); find roots from 2 to 2.5 and an epislon of 0.0001 (hint: you will need to run your program twice, using two different values for xstart). Pipe your output to a text file named hw11-2a.txt. b) f(x) = 30x^3 - 800x^2 - 250x + 20; find a root from 5 to 50 and an epislon of 0.0001 Pipe your output to a text file named hw11-2b.txt. Email your program and text files to me with a Subject Line: MAT3353, hw11 Due: Start of class, Monday, 10/7 ================================================================ HW12: 1) Finish debugging our secant-1007.py from class today. When your program is working correctly, use it to find the roots between 1 and 2 of the following function: f(x) = 3*sin(x^3) - 2*sin(x^2) + 5*sin(x) - 4 Make a copy of your program and name it dj-hw12-secant-1007.py. Send it to me in an email with the Subject Line: MAT3353, HW12a. Include your two roots in the text of the email. 2) Make a copy of your dj-hw12-secant-1007.py program and name it dj-hw12-secant.py. Add the logic and lines to the secant function in this program to protect against the division by zero possibility in the xnew = x1 - y1/m line. Email your program to me in an email with the Subject Line: MAT3353, HW12b. Due: Start of class, Wednesday, 10/9 ================================================================ HW13: Modify our secant-method-with-errors-printed.py from our 1009 work to print the absolute, relative, and percent relative error on each line of the iterations. Name your program dj-hw13-secant-with-errors.py and email it to me with a Subject Line of: MAT3353, HW13 I am using the x^2 - 9 function we used in class last Wednesday and your program output should be similar to this: Due: Start of class, Wednesday, 10/16 ================================================================ Our first test will be on Wednesday, 10/16! Make sure you have your computer in proper working condition, as you will use it for all test questions. Each answer will be emailed to me (like you do on the homework). I would recommend the Windows users turn off any Updates for the day of our test! ================================================================ R&S Chapter 3.1 - 3.2 in our text (pages 55-63). HW14: 1) Finish the program we started in class, trap.py. When you finish it, email it to me with the program name dj-hw14-trap.py. Use a Subject Line of: MAT3353, HW14 2) Make a copy of your trap.py program and name it dj-hw14-trap-with-errors.py. Modify the trap program to print the absolute, relative, and percent relative errors at the bottom of the program. Make your output look similar to the example below. Email your program to me with a Subject Line of: MAT3353, HW14. Sample output: 3) Use your trap program with 6 regions to solve problem 14.5 in Schaums. Name this program dj-hw14-p3.py. Email your program to me with a Subject Line of: MAT3353, HW14. Due: Start of class, Monday, 10/28 ================================================================ HW15: 1) Finish deriving the algorithm for the midpoint method we started in class today on the board. When the class is finished with a great algorithm on the board, take a picture and send it to me in an email. 2) Write a midpoint program using your algorithm. It will be very similar to your trapezoid program. I would just make a copy of my trapezoid program and name it midpoint.py and modify it appropriately. Do not have any error analysis in this program. Use it to find the integral of x^2 from 1 to 3 and send me a copy of your program. Name it dj-midpoint.py and use the Subject Line: MAT3353, Hw15. 3) Now, you may have noticed that since the trapezoid and midpoint programs are so similar, the only difference in the two programs is the trapezoid or midpoint function definition. This means that you could just put both functions in the same program and use either method just by calling that function. So, what I want you to do is create a program that has both function definitions in it, and when you run the program, have it print both the trapezoid and midpoint answers. Name your program dj-integrate.py and email it to me with the Subject Line: MAT3353, HW15. I have included an example of the output I want with two different programs runs below. Your output should be very similar to mine, including the number of decimal places shown: Due: Start of class, Monday, 10/28 ================================================================ HW16: 1) Finish the while loops for the simpson's method program we started in class today. When you finish, use your program to find the definite integral of sin(x) from x = 1 to x = 3. The exact answer (to 7 decimal places) is: 1.5302948. Name your program dj-simpsons.py and email it to me with a Subject line of: MAT3353, HW16. Your output should be similar to this: Due: Start of class, Wednesday, 10/30 ================================================================ HW17: 1) Make a copy of your dj-integrate.py program and name it dj-integrate-with-errors.py. Modify the new program to print errors VERY similar to the example below for any function and number of iterations. Write the program so that it will work if the user uses a different function and exact answer. Email your program to me with the Subject Line: MAT3353, HW17-p1. 2) Make a copy of your dj-simpsons.py program from class on Wednesday and name it dj-hw17-p2.py. Use your program to find the integral of e^(sin x) * cos(e^x) from x = 1 to 5. Use enough regions so that you feel you have at least 8 decimal place accuracy. Email your program to me, along with the number of regions to use to get the requested accuracy. Use the Subject Line: MAT3353, HW17-p2. 3) Make a copy of your dj-integrate-with-errors.py program from part 1. Use it to compare the three methods in finding the integral of x^5 - 10*x^4 + x^3 + x^2 + 5000 from -2 to 5. Which method is best and why? Email your answer to me using the Subject Line: MAT3353, HW17-p3. Due: Start of class, Monday, 11/4 ================================================================ HW18: Here is a link giving a great example of where the error terms for the Trapezoid and Midpoint methods come from. This is pretty high-level analysis and is not typically covered in an Intro to Numerical Analysis course. What we will do is learn how to use these results. Here are the error terms for the three methods we have studied. Use them in finding how many regions are needed for a desired accuracy in all three methods. HW18 Prob: Do the problem below. Make a copy of your dj-integral.py program, either from class today or from your 1030 folder and name it dj-hw18-prob.py. Run your program to solve the problem and capture your output to a text file named dj-hw18-answer.txt. Email these two files (your program and the capture of your output) to me with a Subject Line: MAT3353-HW18. Due: Start of class, Wednesday, 11/6 ================================================================ HW19: Do the 4 problems on this handout that I gave out in class on Wednesday. These are all done on paper. Have them ready to turn in at the beginning of class on Monday. Note that I changed the wording on the handout to make it more similar to the examples we worked in class. You may want to download and print the handout for your homework. The key to these problems is here. Due: Start of class, Monday, 11/11 ================================================================ Sample Test 2 questions are here. For Test 2, I will provide a simpson.py and integrate.py program for you to start with. You can find them here. We will discuss these in class on Monday. There will also be a question similar to those on HW19. Our test will be on Wednesday. ================================================================ HW20: 1) Finish our eulers program from class last Monday. Name your program dj-eulers-method.py. Use the ode we worked on in class from Example 1 on this handout. When you have it, email it to me with the Subject Line: MAT3353, HW20a. Your output should look like this: 2) Make a copy of your program from problem 1 and name it dj-error-eulers-ex1.py. Add the exact solution to your output in order to compare the euler's answer with the exact one. When you have it, email it to me with the Subject Line: MAT3353, HW20b. Your output should look like this: Due: Start of class, Monday, 11/18 ================================================================ HW21: Note: The euler program example I used in class on Monday had a slight error in it. I have fixed the error and uploaded the program (dj-euler.py) to the Example Files, 1118 folder on the website. You will need to re-download the program for your homework! 1) Make a copy of your dj-euler.py program and name it dj-hw21-prob1.py (use your own initials). Modify that program to solve the ode below, using a step size of 0.2 and and ending point (n) of 2. When you have it done, email it to me with the Subject Line: MAT3353, HW21 prob1. Below is an example of what your program output should look like: ode: 2xy - 9x^2 + (2y + x^2 + 1)y' = 0 , y(0) = -3 2) Your solution to problem 1 is not very accurate because we used such a large step size (h) of 0.2. For this problem, make a copy of your dj-hw21-prob1.py and name it dj-hw21-prob2.py. Edit the program to comment out the print statement in the euler while loop. Run the program with smaller h's until you find one that gives a reasonably accurate solution to y(2). When you have that reasonable answer, run your program and capture the output to a text file named dj-hw21-prob2-output.txt. Email both your program and output file to me with the Subject Line: MAT3353, HW21 prob2. 3) Download the dj-integrate-with-errors.py program from the Examples 1118 folder. Make a copy of it named dj-hw21-prob3.py. Modify the program to print the errors for the euler method compared to the exact solution. We are solving the same ode as in problem 1. The exact solution to this ode is: y(x) = ( -(x^2 + 1) - (x^4 + 12x^3 + 2x^2 + 25)^(1/2))/2. When you have it done, email it to me using the Subject Line: MAT3353, HW21 prob3. Your output should match the example below: Due: Start of class, Wednesday, 11/20 ================================================================ HW22: There are two files you will need for the starting point of each problem. They are located in the hwfiles link (Link 7 at the top of the page) in the hw22 folder. One file is dj-eulers-final.py. This one performs the eulers method with the print line in the loop commented out. The other file is dj-error-eulers-exact.py. This one performs the euler's method and shows the error in the euler answer compared to the exact answer. Of course, you can only use this one if you know the exact answer. For each homework problem below, you make a copy of one of these files and use that copy to do the problem. Problem 1: Make a copy of the dj-eulers-final.py program and name it dj-hw22-prob1.py (use your own initials). When you have the problem solved with as good an answer you can get, pipe the output to a file named dj-hw22-prob1-output.txt and email both the program and the output to me with a Subject Line: MAT3353, HW22 Prob1. Solve this ode: 2xy^2 + 4 = 2(3 - x^2y)y' = 0 , y(-1)= 8 for x = -1 to -0.1 Problem 2: Make a copy of the dj-eulers-final.py program and name it dj-hw22-prob2.py (use your own initials). When you have the problem solved with as good an answer you can get, pipe the output to a file named dj-hw22-prob2-output.txt and email both the program and the output to me with a Subject Line: MAT3353, HW22 Prob2. Solve this ode: (2ty)/(t^2 + 1) - 2t - (2 - log(t^2 + 1))y' = 0 , y(5)= 0 for x = 5 to 6 Problem 3: Make a copy of the dj-errors-euler-exact.py from the hw22 files folder and name if dj-hw22-prob3-exact.py (use your own initials). This program prints the errors compared to the exact answer for this problem. For the ode in problem 2, the exact answer is 6.828405043895. When you have the program completed, run it to get a good approximate answer and pipe the output to a text file named dj-hw22-prob3-output.txt. Email the output file and the program to me with a Subject Line: MAT3353, HW22 Prob3. Due: Start of class, Monday, 12/2 ================================================================ HW23: For today's lecture, Read and Study the Schaum's chapter on the Runge-Kutta method for ode problems (chapter 19). Copy the program dj-eulers-final.py from the hw22 files link ( same as in the link in HW22). Make a copy of that program and name it dj-rk4-start.py (use your own initials). Use formula here (based on problem 19.6). to replace the euler's function with a rk4 function to solve a given ode. Use your new program to solve the same problem as HW22, Problem 3 above. When you have it, run your program and pipe the output to a text file named dj-hw23-output.txt. Email the output file and the program to me with a Subject Line: MAT3353, HW23. Due: Start of class, Monday, 12/2 ================================================================ HW24: The problem is here. Due: Start of class, Wednesday, 12/4 ================================================================ Practice problem for the Final Exam (The graph of the analytic solution to this problem is here .) (Your graph should be similar) ================================================================ Final Exam Material: Problems will be similar to the HW23 and HW24 assignments. (We will use only the RK4 method for solving ode problems) Problems 1 and 2 will be similar to HW24 or the practice problem. Problem3: I will have you add another method function to your RK4 program. I will give you the derived algorithm, similar to the RK4 formula (">here). I will then ask you to use this program to solve one of the problems you solved for problem 1 or 2. ==================================================================================
The final exam for MAT3353.01 (the M/W 1:15 section) is on Monday (Dec 9th) from 12:15 - 2:15 PM in this room. Bring your calculator and computer and your study sheets.
============================================================ Note: On all emails for this course, start the subject line out with MAT3353, followed by whatever else is appropriate. Emails without this subject line formatting may not be accepted!



Return to Rejoice Always Home


Last updated on ... 8/3, 2019
Created on ... 8/3, 2019