---------------------------------------------## Homework Assignments

## HW0: Install the appropriate from the links above on your computer. Bring your computer to class with you on Monday! Due: Monday, 8/29 --------------------------------------------------------------- HW1: Do this assignment All the required files are on the website (link 6 above). Due: Start of class, Wednesday, 9/7 --------------------------------------------------------------- HW2: Do this assignment All the required files are on the website (link 6 above). Note: I had a typo on the original hw02 assignment. Problem 2 read "x^(1/2) + sin(x)" whereas the values shown were for "x^(1/2) * sin(x)". I had changed my mind on which function to have you use for the problem. The values on the website hw02-assignment.txt now match the correct function. I apologize for any inconvenience! Due: Start of class, Monday, 9/12 --------------------------------------------------------------- HW3: Do this assignment All the required files are on the website (link 6 above). Example programs for today's lecture Note: Once again, I had a typo on the original hw03 assignment. I have corrected the output samples on problems 3 and 4. They now correspond with the function as specified in the assignment. The previous output samples were for other functions. I apologize for any inconvenience! Due: Start of class, Wednesday, 9/14 --------------------------------------------------------------- HW4: Do this assignment Link to the folder where hw04a is. Example programs for today's lecture Due: Start of class, Monday, 9/19 --------------------------------------------------------------- HW5: Do this assignment (hw05) Link to the folder where hw05a is. Example programs for today's lecture Due: Start of class, Wednesday, 9/21 --------------------------------------------------------------- HW6: Do this assignment (hw06) Link to the folder where hw06a-secant-line is. Example programs for today's lecture Due: Start of class, Monday, 9/26 --------------------------------------------------------------- Some good predict-the-output practice problems from an old test (answers - don't look at these until you have tried the problems!) --------------------------------------------------------------- HW7: Do this assignment (hw07) Link to the folder where the files for hw07 are. Example programs for today's lecture Due: Start of class, Monday, 10/3 --------------------------------------------------------------- Our first test will be Wednesday, 9/28. It will be a paper exam - no computer needed! --------------------------------------------------------------- HW8: Apparently, there is no homework for tomorrow! --------------------------------------------------------------- HW9: Use the x-eq-g-of-x program we finished with in class on Wednesday (my copy is here) to solve the following problems from our text (all from chapter 25). Use an accuracy for your solution of at least 6 decimal places. 25.49 (try to find a rearrangement to use the x-eq-g-of-x program) 25.49 Use Newton's method (my copy is here) 25.51, 25.67, 25.68, 25.82 Name each program like this: david-hw09-p49-x-eq.pl, david-hw09-p49-newtons.pl, david-hw09-p51.pl, david-hw09-p67.pl, david-hw09-p68.pl, david-hw09-p82.pl (replace david with your name!) Due: Start of class, Monday, 10/10 --------------------------------------------------------------- HW9 Modification: I have been inundated with questions from most of the class regarding the homework. The single common problem everyone seems to be having with the problems is that you are forgetting all the great things you learned about functions and roots of functions in pre-cal. Most of you have made the mistake of sitting down to code your solutions without having a clear understanding of the problem you are solving. This may not apply to each of you, but it applies to many who have asked questions. The first thing most of you need to do is put your computer away, take out a sheet of paper and make sure you understand the answers to the following questions. 1. What is the function I am trying to find the root of? If you are in a x=g(x) problem, like problems 49a, 51, 67 and 82. Once you have the function f(x) written down, then start trying different x=g(x) arrangements to make it work. I am moving the due date for these problems to Wednesday, BUT, I am adding an element to the homework. Do this new element first: For each problem, on paper, figure out what the f(x) function is. Bring this to class with you. Make a copy of it to give me. This should be done on paper with supporting work for how you figured out what your function is. Sometimes this will be algebraic, sometimes it may involve a graph, sometimes both. All three of these elements will always be in agreement! Does this make sense? D. Joyner --------------------------------------------------------------- HW10: Here is the homework assignment. Here is a working copy of the midpoint program we wrote in class. Here is the full handout on mumerical integration. --------------------------------------------------------------- HW11: For reference only, here is a derivation of the error for the trapezoid rule. This derivation is not usually covered in an intro NA course, I am including it here only so that you can see some of the math involved in how the error bound was derived. We will just use the error bounds as they are given to us. Here is our working simpson's program we developed in class today. The program already has the function we were working on in it. The analytic answer for the integral of f(x) = 1/x for x from 1/100 to 1 is 4.605170186. Add lines to the simpson's program so that it shows the approximate value of the integral, the exact value, and the absolute value of the difference between them. If I run the program with this line: perl hw11-simpsons.pl 0.01 1 128 I get the following result: f(x) = 1/x a = 0.01 , b = 1 , n = 128 , delta = 0.007734375 the simpson's value for the integral is: 4.611077705162 the exact value for the integral is: 4.605170185988 the difference between them is 0.0059075192 or 5.9075e-03 Your output should be the same. Name your program david-hw11-int-simpsons.pl and email it to me. (replace david with your own name) --------------------------------------------------------------- HW12: The assignment and needed files are here. For each of the problems, do your work like we did in class and if you have any trouble with one, send me a picture of your work to that point and ask a question. Pay attention to the hint! I did find a problem similar to the nightmare we finished up on in class, but much more manageable. Give it a try! Due: Start of class, Monday, 10/24 --------------------------------------------------------------- HW13: R&S the following articles on the Romberg method: 1. Question answer using Romberg's from MathExchange 2. Good summary to the theory behind Romberg's Method 3. Basic example we used in class today 4. ANother good article Due: Start of class, Wednesday, 10/26 --------------------------------------------------------------- Excellent brief tutorial on Perl arrays --------------------------------------------------------------- HW14: If you are interested, here is a pretty good set of slides presenting a summary of adaptive integration. We will not pursue this in class, but it presents the "next step" in numeric integration. Excellent site for sample programs in different languages. This particular link is for gauss-quadrature numeric integration. Here is an interesting open source programming language with many powerful features. Here is a great way to do Javascript at the terminal on macs (or win or linux). Here and here and here are three links on running Javascript in a terminal. Sample programs from today's 1025 lecture are here Here is where the homework link will be when I figure out what to do! Homework: Work the following problems from our text. No matter what the instructions say, use our romberg6a program to find the answer. For each problem, send me the answer to each question and the program you used for that specific problem. For example, for problem 52, name your program "david-hw15-p52" (replace david with your own name). Be careful with number 60. If you just integrate the function given, that is NOT what the problem is asking for. You might need some of your cal2 skills for that one! Schaum's 14.52, 60, and 67. Due: Start of class on Monday, 10/31 --------------------------------------------------------------- HW15: Complete the scd.pl program (here is the program as far as we had it in class). Have your program print out a chart like the following for our problem 60 from HW14: x scd(x) ss(x) -------------|--------------|--------------| 0.9900000000 | 0.0901068273 | 0.2823118843 | -------------|--------------|--------------| 0.9990000000 | 0.0284728748 | 0.0894259470 | -------------|--------------|--------------| 0.9999000000 | 0.0090032382 | 0.0282837409 | -------------|--------------|--------------| 0.9999900000 | 0.0028470525 | 0.0089442551 | -------------|--------------|--------------| 0.9999990000 | 0.0009003164 | 0.0028284266 | -------------|--------------|--------------| 0.9999999000 | 0.0002847050 | 0.0008944272 | -------------|--------------|--------------| 0.9999999900 | 0.0000900316 | 0.0002828427 | -------------|--------------|--------------| 0.9999999990 | 0.0000284705 | 0.0000894427 | -------------|--------------|--------------| Where scd represents the distance of twice the circle with radius 1 using the given x-coordinate and ss represents the distance of the secant line between (1,0) and (x,f(x)) for the given x. In my program, I decided to discard the input argument and just set x=.9 to start the loop. Also, I ended up adding another function, f(x) for the y-coordinate of the point for the secant line. This was pretty easy. You do it however it seems best to you! Name your program david-hw15-scd.pl (replace "david" with your own name!). Due: Start of class on Wednesday, 11/2 --------------------------------------------------------------- HW16: Finish the lagrange-poly.pl program we started in class on Wednesday. Name your program david-hw16-lp.pl (replace "david" with your own name!). Due: Start of class on Monday, 11/7 --------------------------------------------------------------- HW17: Link used to create my cubic-spline example on our data set from Wednesday. The homework description is here. Due: Start of class on Wednesday, 11/9 --------------------------------------------------------------- HW18: Use the startup file ( here ) to write your divided differences program as we started in class. I have already included the data set in the startup program for you. A program like this usually takes several tries before success is achieved. If you do not get it done by Monday, send me your attempt(s) so that I can see how you were thinking. It often takes several "false starts" to get your mind around a good way to accomplish your goal. Name your program david-hw18-div-diff.pl (replace my name with your own). Due: Start of class on Monday, 11/14 --------------------------------------------------------------- HW18: Hints and helps: Let me say two things that might help for anyone still trying to get their divided difference program working. First, get the nested for-loop that creates the divided differences table first. Once you have that, then use those values in a nested loop to create the polynomial value for any given x. I found it easier to separate the two tasks by putting each into a subroutine. Second, try using the intermediate terms of the polynomial I have given below for our oft-used data-set. Good luck! Here is a pdf showing the term by term values of our classic data set. Here is the finished divided differences program. --------------------------------------------------------------- HW19: Finish the euler program. A start-file is here. Use your euler program with the data we used in class today (dy/dx = xy, y(0) = 2) to complete this table: N | h | y(1) ----|----|----------- 2 | .5 | 2.5 ----|----|----------- 5 | | ----|----|----------- 10 | | ----|----|----------- 100 | | Name your program david-hw19-eulers.pl and email it to me (replace david with your own name). Excel file that shows intermediate results of eulers method for various values of h Due: Start of class on Wednesday, 11/16 --------------------------------------------------------------- Some sample questions for Monday's test are

here--------------------------------------------------------------- Here is the online version of Test 3 --------------------------------------------------------------- HW20: Use your euler program to print the x|y chart for the wolves-rabbits population ode we looked at in class on Wednesday, 11/16. The ode was: dy/dx = ( (x - 1000)*y ) / ( 50*x*(80 - y) ) , y(1000) = 40 (where x is the number of rabbits and y is the number of wolves) Construct an x/y chart for values of x from 1000 to 2800 in increments of 100. Due: Start of class on Wednesday, 11/30 --------------------------------------------------------------- HW21: Write a program with a subroutine to perform a runge-kutta 4th order method for odes. Use the handout we gave in class today and solve the problems given in it. Name your program david-hw21-rk4.pl (replace david with your own name). Email your working program to me! Here are some good links on the Runge-Kutta 4th method: 1) The handout we used in class today is here 2) This is a link that explains the weighting process of the values for k Due: Start of class on Wednesday, 11/30 --------------------------------------------------------------- Final Exam Project: Choose One of the Following Options: Option 1: Create an ode problem named david-final-ode.pl (replace david with your own name) that meets the following specifications: a) You will run it with five command-line input parameters in this order: x0 , y0 , xn , showstep , h example: perl david-final-ode.pl 1000 40 2800 300 10 b) Your program should produce the output in a table similar to the following: h = 10 x | y - eulers | y - rk4 1000 | 40.00 | 40.00 1300 | 40.74 | 40.77 1600 | 42.74 | 42.79 1900 | 45.90 | 45.98 2200 | 50.51 | 50.64 2500 | 57.59 | 57.87 2800 | 73.86 | 77.37 Hint: Have an euler's and an rk4 subroutine in your program. Run a for-loop in your main program and save the euler results into an array. Run another for-loop and save the rk4 results into an array, then print the table using the array elements in the for loop for the table. This is not the only way to get what you want, but it is a good way! Option 2: Use your rk4 program and some analysis to figure out what differential equations to use to get all the values of the wolf/rabbit populations given by the direction fields graph. Name your program david-final-wrpop.pl (replace david with your own name) and email it to me when you are finished. Due: No later that midnight, Thursday, 12/8 --------------------------------------------------------------- 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!

Last updated on ... 8/18, 2016

Created on ... 8/18, 2016