MAT 3353 Numerical Analysis, Fall 2018, 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. ActivePerl 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 (nothing here yet)

8. Example Files

9. Textbook for this semester

10. Excellent Intro Guide to Octave
============================================================

Homework Assignments

HW0: Windows Users: 1) Download Active Perl from link 4 above and install it. 2) Download Notepad++ from link 3 above and install it. 3) Download the text from link 8 above. 4) Watch this Geno Auriemma link. (This is how I feel about engagement in this class!) 5) Bring your computer to class with you on Thursday! (Make sure you have performed all updates BEFORE you come to class!!) Mac Users: 1) Download BBedit from link 5 above and install it. 2) Download the text from link 8 above. 3) Watch this Geno Auriemma link. (This is how I feel about engagement in this class!) 4) Bring your computer to class with you on Thursday! Due: Start of class, Thursday, 8/23 ============================================================ HW1: Edit your perl1.pl program we created in class Thursday so that is does the following: 1) Use 6 variables, a, b, c, d, e, and f to have your program store the value of two numbers in variables a and b. Then store the sum of those variables in c, the difference of those variables in d, the product of those variables in e, and the quotient of those variables in f. 2) Put appropriate print statements in your program to show the following results: (Note: Your program output should be identical to mine except, of course, use your own name in place of mine) 3) Send your program to me as an attachment to an email with the subject line: MAT3353 HW1 4) My email address is: david.joyner@LCU.edu Due: Before start of class, Tuesday, 8/28 ============================================================ HW2: 1) Download the sample file console-input.perlscript from the Examples folder for today (0828) You will then need to change the filename suffix from .perlscript to .pl. There is a reason for this. 2) Put the file in your 0828 folder we created in class on Tuesday. 3) Run the program several times, using different values for x to see what the program does. Try some positive and negative values for x. 4) Make a copy of the file named hw2-dj.pl (use your own initials in place of dj). 5) Modify your hw2-fj.pl file to make it work for the function f(x) = sin(x^2 - 2x + 3.5) 6) Verify with your calculator that your program is giving correct results. Note that perl will use radians for the angle, so when you use your calculator to check results, make sure it is also in radian mode. 7) Send me your hw2-dj.pl program as an attachnent in your email. use the subject line: MAT3353 - HW2 in your email. Due: Before start of class, Tuesday, 9/5 ============================================================ HW3: 1) Create a folder named 0830 in your perl folder for today's work. 2) Download the sample files documentation-comments-warnings.perlscript, simple-parameter-input.perlscript, and simple-parameter-input2.perlscript from the Examples folder for today (0830) You will then need to change the filename suffixes from .perlscript to .pl. 3) Make a copy of the documentation-comments-warnings.pl file named perl-template.pl 4) Download the sample file hw3-start.perlscript from the Examples folder for today (0830) You will then need to change the filename suffix from .perlscript to .pl. 5) Make a copy of the file named hw3-dj.pl, using your own initials in place of dj. 6) Modify that file to work with two functions, f(x) = x^(1/2), and g(x) = x^(1/3). Add lines to your program to give output like my example, when I run the program with this line: perl hw3-dj.pl 200.5 7) Email your program to me as an attachment with the Subject line: MAT3353: HW3 Due: Before start of class, Tuesday, 9/4 ============================================================ HW4: 1) Use your 0904 folder we created today in class for this homework. 2) Download the sample file hw4-start.perlscript from the Examples folder for today (0904) You will then need to change the filename suffix from .perlscript to .pl 3) Make a copy of the file you just downloaded and name it hw4a-dj.pl, using your own initials in place of dj. 4) Run the program a few times with different input parameters to get an idea of what it does. 6) Modify that file to work with two functions, f(x) = x^(1/2), and g(x) = ( e^x )^(1/3) - 2. Add lines to your program to give output like my example. 8) Make a copy of your hw4a-dj.pl and name it hw4b-dj.pl. Modify hw4b-dj.pl to give the exact same output, but use a while loop in place of the for-loop. 7) Email your programs to me as an attachment with the Subject line: MAT3353: HW4 Due: Before start of class, Thursday, 9/6 ============================================================ HW5: Good link with details on using the printf statement 1) Download the hw5-start.txt file from here. 2) Make a copy of that program and name it hw5-dj.pl (use your own initials in place of dj). 3) Modify the program to produce a table of values for two functions, f(x) = 1/x^(1/3) and g(x) = tan(e^x). Your program should include the following features: 1) Use functions for f(x) and g(x). 2) Use formatted print statements to make your output "pretty". 3) When you run your program, the output should be like this: 4) Email your completed program to me as an attachment with the Subject line: MAT3353 - hw5 5) Download the text from link 9 above and read and study pgs 1-5. Due: Before start of class, Tuesday, 9/11 ============================================================ HW6: Part 1: Do the following problems from the text on pg 8: 2; 3a,b,d,e; 4a,b,d,e; 5a,b,d,e; 6a,b,c; 7;8 (feel free to use a calculator on these two instead of using Octave); 12a,b; 13a,b; 14a,b Have these on paper, ready to turn in! Part 2: Download the program debug2.txt from here, change the name to debug2.pl and correct all the errors in it so that it runs successfully. A copy of one of my runs is below: Note: you do not need to email it to me. I will trust you to get it done! Due: Before start of class, Thursday, 9/13 ============================================================ HW7: 1) Download the program "hw7-start.txt" from here 2) Rename your program to hw7-dj.pl (replace my initials with your own). 3) Attempt to modify the program to add the following columns to the output, to give an idea of the absolute and relative difference from one term to the next. 4) Note: This is a pretty challenging assignment! If you spend a great deal of time on it, without ultimate success, just email me what you have done and we will discuss it in class tomorrow (on 9/18). Just show me some real work on the problem! I know that you have other classes. Do NOT spend many hours on this program! 5) Here is a sample run of my program: Due: Before start of class, Tuesday, 9/18 ============================================================ HW8: 1) R&S 1.2 (Taylor Series) and 1.3 (Speed) in our textbook. 2) Have a working copy of Octave installed on your computer when you come to class. Due: Before start of class, Thursday, 9/20 ============================================================ HW9: 1) Do 1.2 #'s 1a,b,d,4,8,9,10,11,12a,12b; R&S 1.3. Due: Before start of class, Tuesday, 9/25 ============================================================ HW10: 1) R&S Section 2.1 in the text (pgs 37-42). 2) Finish HW9 if you did not do so. Have it ready to turn in. Due: Before start of class, Tuesday, 9/25 ============================================================ Interesting 2001 article on Octave by its creator Excellent Intro Guide to Octave ============================================================ HW11: 1) Create bisection.m and bisection2.m from 2.1 in our text. 2) Do 2.1 #'s 2b,2e,13,32 3) Use the Octave bisection2 program to find the 5 roots to the function f(x) = sin(e^x) + ln(x) between 0.2 and 3. Once you have found all the roots, save your workspace by typing "save hw11p3" at the octave command line. Email that file to me. 4) Convert the bisection2.m program to a perl program. Make a copy of it named bisection-dj.pl (use your own initials in place of mine) and make changes to that program until it works in a similar manner, with the difference mentioned in class. 5) R&S 2.2. Due: Before start of class, Tuesday, 10/2 ============================================================ HW12: 1) Finish HW11 if you did not. Turn in the "paper" parts of HW11. 2) Do 2.2 #'s 3a,3c,3f,3g on paper. 3) Run your fixed-point.pl program with each problem in 2.2 and see if it converges to the fixed point you found there. 4) R&S 2.3. Due: Before start of class, Thursday, 10/4 ============================================================ HW13: 1) Find a different x=g(x) arrangement to find the roots of f(x) = -x^3 + 5x^2 - 3x - 6 from the one we used in class on Thursday. Name your perl program hw13-p1-dj.pl (use your own initials) and email it to me. 2) Solve 2.2 #'s 14,15,19. For each problem, name your perl program hw13-p14-dj.pl, hw13-p15-dj.pl, and hw13-p19-dj.pl and send it to me (use your own initials). 3) R&S 2.4 Due: Before start of class, Tuesday, 10/9 ============================================================ HW14: 1) We developed a working-but-rough-around-the-edges newton's method for finding roots of functions program in class on Tuesday. We named it n1.pl. I put a copy of it, named n1.txt, here. Our assignment, given in class, was to take this program and make a polished newton's method program out of it. The specified changes to make are: a) Add code to the program to take three command-line arguments for x0 (the starting value), maxits, and theaccuracy requirement for the answer. b) Make adjustments to the program to allow the user to enter the function in sub f and the derivative in sub fp. A sample run of the program, using the function we used in class is below. Make your program produce similar (or identical) output. Name your program newton-method-root-dj.pl (with your own initials) and email it to me. Due: Before start of class, Tuesday, 10/16 ============================================================ HW15: 1) We developed a working-but-rough-around-the-edges secant method for finding roots of functions program in class on Tuesday. We named it secant-sandpaper.pl. I put a copy of it, named secant-sandpaper.txt, here. Our assignment, given in class, is to take this program and make a polished secant method program out of it. The specified changes to make are: a) Add code to the program to take three command-line arguments for x0 (the starting value), maxits, and the accuracy requirement for the answer. For this implementation of the secant method, we will just take x0 from the command line arguments and add 0.1 to this for x1. b) Make adjustments to the program to allow the user to enter the function in sub f. A sample run of the program, using the function we used in class is below. Make your program produce similar (or identical) output. Name your program secant-dj.pl (with your own initials) and email it to me. 2) Make a copy of your finished newton's method program from HW14 named c2s4p4a-dj.pl (use your own initials) and use it to do problem 2.4 # 4a. Email your program to me with the indicated program name. Do the same for problems 4b, 4c, and 4d, with appropriate changes to the program name. Include a comment line at the end of each program telling me what x0 you used. 3) Make a copy of your finished secant method program from part 1 above and name it c2s4p4a-secant-dj.pl (use your own initials) and use it to do problem 2.4 # 4a. Email your program to me with the indicated program name. Do the same for problems 4b, 4c, and 4d, with appropriate changes to the program name. Include a comment line at the end of each program telling me what x0 you used. 4) Use your newton program to try to find a root for problem 14 in 2.4. Just do it, you don't need to email me anything. 5) Make a copy of your secant method program and name it c2s4p13-dj.pl (using your own initials). Verify that the value you found in problem 13 actually fails to converge. Email your program to me. 6) Find the indicated root for 2.4 problem 19 using both your newton and secant method programs. How many iterations does each program require using the same x0 and a tol of 1e-4. Just include this answer in your email submissions to me. Due: Before start of class, Thursday, 10/18 ============================================================ HW16: Polish the trap-sandpaper.pl (a copy is available here )program we created in class on Thursday to add the following features: 1) Use the strict and warnings statements. 2) Use command line arguments to give the starting and ending values of x, along with the number of regions to use. 3) Rename your program trap-dj.pl (use your own initials) and email it to me with a subject line of MAT3353 - HW16. 4) Make the output useful, something like this: Note: While this isn't technically due until Thursday, 10/24, I think the techniques you use to do this problem will be helpful to you on one of the test questions! Due: Before start of class, Thursday, 10/24 ============================================================ Test 1 Review Material 1. Make sure you are comfortable with using a newton and secant program to find roots of a function, whether you are given starting points and tolerances for answers or you have to figure out your own. 2. Be able to "debug" a small program (find mistakes) on paper. 3. Be able to take a small algorithm like we did with the newton and secant methods in class and turn it into a working program. 4. Be able to use your newton and secant programs to solve a related problem, like we did in class on Thursday. Here is an example: Use your secant method program to solve this equation: e^(x-5) = sin(x - 4) + 1 , where x > 4 ============================================================ HW17: At this link is an old rough copy of some notes I used for a lecture on the Simpson's Method for numeric integration. It is quit rough, but the correct details are there. See if you can follow it to see a new method for numeric integration. Simpson's method does a better job at eliminating error in each region than the trapezoid method. At the end of the nots is a circled section. This section has the algoritm for Simpson's method. Use it to make a working rough draft of the simpson's method to find the definite integral of e^x for x = 0 to 3. Name your program simpsons-sandpaper-dj.pl (use your own initials) and email it to me. I will add some reading and problems from our Schaum's Outline books tomorrow. R&S Schaum's pgs 118-122; Due: Before start of class, Tuesday, 10/23 ============================================================ HW18: Do the problems here. This is a paper assignment. Have it ready to turn in at the start of class on Thursday. Here is a copy of the error terms for the Trapezoid and Simpson's methods (I put these on the board Tuesday at the end of class) Due: Before start of class, Thursday, 11/1 ============================================================ HW19: 1) Redo problems 3 and 4 from HW18 using our method demonstrated in class on Tuesday. Have all 4 problems ready to turn in on paper. 2) Make a copy of your simpson's method program and name it hw18-p4-dj.pl (use your own initials). Use it to find what you think is the value for n (the number of points) to get the most accurate you can. Add a comment at the bottom of your program indicating what n you used and what the value of the integral is. Email this program to me using the subject line: MAT3353 - HW18. Due: Before start of class, Tuesday, 11/7 ============================================================ HW20: 1) Make a copy of your simpson's program and name it hw20-p1-dj.pl (use your own initials). Remove the lines for the exact answer and error - you won't need them. Use your program to find the definite integral of e^(-x^2) from x = 0 to x = 4, with n = 16384. 2) Do problems a and b on this handout . Due: Before start of class, Thursday, 11/8 ============================================================ HW21: 1) Read this excellent handout on Euler's Method. 2) Work This problem out by hand with a calculator on paper: Use Euler's Method to find y(0.5) for y' = x - y + 2 , given that y(0) = 2. Use h = 0.1. Due: Before start of class, Tuesday, 11/14 ============================================================ HW22: 1) Make a copy of euler-sandpaper-start and name it h-dj-euler.pl (use your own initials). Modify it to make a program that uses command-line arguments with the first argument being x0, the second being y0, the third being xn, the fourth being h and the fifth being a print-flag (y/n). Your program should produce output like these two examples: 2) Make a copy of h-dj-euler.pl and name it n-dj-euler.pl (use your own initials). Modify it to use a value for n in the fourth argument, instead of h. Your program should produce output like these two examples: 3) Use your h-euler-dj.pl program to solve this differential equation: Find y(1.62) if y' = -2xy with y(0) = 1. Add a comment to the last line of your program telling me what h you used. 4) Use your n-euler-dj.pl program to solve this differential equation: Find y(1.96) if y' = -(2x + y)/(2y - x) with y(1) = 0. Add a comment to the last line of your program telling me what h you used. Email your programs for problems 3 and 4 above to me with a subject line of: MAT3353 hw22 Due: Before start of class, Thursday, 11/15 ============================================================ Note to everyone about adding the print flag. In perl, if statements with string variables use different symbols (called operators) for strings. So your if statement will need to look similar to this: if ($pf eq "y") { print "stuff"; } Notice you need to put $pf eq "y" , Do NOT use $pf == "y". It won't work! ============================================================ HW23: 1) Make a copy of your h-euler program and name it runge-kutta4-dj-sandpaper.pl (use your own initials). Use our runge-kutta formula here to create a runge-kutta 4th order program to solve our differential equation of problem 3 on HW22. It should use a sub for the function, f, like we usually do. Do not use any command-line parameters or the use strict and warning statements. Just initialize the proper variables in your program before your loop that performs the runge-kutta algorithm. Here is a sample of what it should look like (using almost p3 from the last homework with an h of 0.1 and an xn of 1.6): (Note: If any of you are missing class tomorrow, your homework is still due at the start of class! If you wait until you get back from Thanksgiving Break, it will be counted late.) Due: Before start of class, Tuesday, 11/20 ============================================================ HW24: 1) Make a copy of your h-euler-dj.pl program and name it rk4-dj.pl. Modify it to use the runge-kutta method from your hw23 sandpaper program. It should use the exact same input parameters as your h-euler program (x0, y0, xn, h, pf). Use this program to solve hw22, p3. Email it to me with the program name rk4-dj.pl (use your initials) with a subject line: MAT3353 HW24-1. 2) Make a copy of your rk4-dj.pl program from problem 1 above and name it hw24-rk5-dj.pl. Modify it to use the rk5 method I gave out in class here (for those who missed class). It should use the exact same input parameters as your h-euler program (x0, y0, xn, h, pf). Use this program to solve hw22, p3. Pick what you think is a good h to give a good result. Include your solution and input parameters as a comment at the end of your program. Email it to me with the program name hw24-rk5-dj.pl (use your initials) with a subject line: MAT3353 HW24-2. Due: Before start of class, Tuesday, 11/27 ============================================================ HW25: These are all similar to the kinds of questions I will ask you to do on our final exam. Here are correctly working copies of the programs you will need to use for theses questions and the final exam. I named all of them with a .txt file extension, which you will want to change to .pl after you download them. If you prefer to use your own programs instead of mine,you are welcome to do so! Note: With this many proframs using different input parameters, it is easy to forget what parameters you should use. To remind yourself what parameters you need to use for a program, just run it without any parameters and it will remind you. For example, just type: perl simpsons-dj.pl , and you will see what parameters the program expects. 1) Use your simpsons program to the area between the curve y = e^(-x^3 + 2x^2) - 2 from x=0 to 1.7. Note that you need to use what you know about definite integrals and area from cal 1 to answer this question correctly. In particular, you need to know where the zeroes for this function are. You can either use your calculator for this or you could use your secant program for finding zeroes - it is your choice. Include a comment at the end of your program with the area you found. Email your program to me with a subject line of: MAT3353, HW25 p1. 2) Make a copy of rk4-dj.pl (from the link above) and name it hw25-p2.pl. Use this program to find y(3) from the differential equation y' = -x*y^2 with the initial condition y(-3) = 0.2. Modify the print statement to produce output like the example below, then pipe your output to a text file named p2.txt (like we did in class on Tuesday). Email your program to me, and the text file with a subject line of: MAT3353, HW25 p2. Output: 3) Make a copy of rk4-dj.pl and name it hw25-rk4-p3-dj.pl (use your own initials). Make a copy of rk5-dj.pl and name it hw25-rk5-p3-dj.pl (use your own initials). Use each program to find the solution for y(3) to the differential equation y' = x*y^(1/3), with y(1) = 1. Use an h = .1. The exact answer is: 7.0211321356. Add lines to each program to show the absolute and relative percent errors. Put a comment at the end of each program showing the solution with the error statements. Email them to me with a subject line of: MAT3353, HW25, p3. Due: Before start of class, Thursday, 11/29 ============================================================
The final exam for MAT3353.01 (the T/Th 10:40 section) is on Thursday (Dec 6th) from 10:00 AM - Noon in this room. Bring your calculator (NOT a phone, ipad, android, or other internet capable device) 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 ... 7/30, 2018
Created on ... 7/30, 2018