============================================================## 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 ============================================================

The final exam for MAT3353.01 (the T/Th 10:40 section) is onThursday (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!

Last updated on ... 7/30, 2018

Created on ... 7/30, 2018