MAT 3353, Numerical Analysis (M/W 2:30-3:45 Class), Fall 2014

Good Links

1. Course Syllabus

2. Miscellaneous Class Files

3. Notetab Light - an excellent editor for Windows systems for programming

4. Some useful Python Programming Links

5. Copies of our daily work in class
--------------------------------------------- 


Homework Assignments

HW1: Send me an email with the following details about your computer: OS Version, Amount of Ram, CPU info. Due: Wednesday, 9/3 --------------------------------------------- HW2: Read and Study 0.1, 0.2 and 0.4. Make a set of notes of things that either puzzle you or that you find interesting. Let me have a copy of those notes either by hardcopy at the start of class or you can email a copy. We will discuss these at the start of class on Monday. Read and Study the handout on Archimedes' method of approximating pi. Bring your computer to class with you for our first intro to Python programming! (Windows Users: Have ActiveState Python installed and ready to go!) Due: Monday, 9/8 --------------------------------------------- HW3: Add the following lines to your helloworld1.py program: a = 3 b = 5 print str(a+b) Due: Wednesday, 9/10 --------------------------------------------- Some interesting links with some good comments on non-binary computers: link 1 (best comment is 17 by Mike Chamberlain): link 2 link 3 --------------------------------------------- HW4: Write a program to use two variables, s and n, to calculate the perimeter of a regular polygon using two variables, s (for the length of a side), and n (for the number of sides). Name the program regular-polys.py. Due: Monday, 9/15 --------------------------------------------- HW5: Add lines to your regular-polys.py program so that it reads the variables n and s from the command-line when you call the program. Use the program given in class as a guide. Due: Wednesday, 9/17 --------------------------------------------- Python - Basic for-loop examples Python - Integer range for-loop examples Python - Decimal range for-loop examples using numpy --------------------------------------------- HW6: Write the following programs: Program HW6a name: hw6a.py Program Description: Should print an x/y table for the function y = x^2 for values of x from 1.5 to 2.5 in increments of 0.1 Program HW6b name: hw6b.py Program Description: Should print an x/y table for the function y = 2x^3 + 3.5x^2 - 5x for values of x from -4 to 4 in increments of 0.1 Program HW6c name: hw6c.py Program Description: Should print an x/y table for the function y = 0.3*sin(x) for values of x from -3 to 7 in increments of 0.2 (Hint: You will need to use the internet to find out how to evaluate a trig function in Python!) Program HW6d name: hw6d.py Program Description: Modify program hw6a.py to take the start, end and step values for the table from as command-line arguments. For example: "python hw6d.py 3 4 0.2" should print the x/y table for values of x from 3 to 4 in increments of 0.2. Due: Wednesday, 9/24 --------------------------------------------- HW7: Use the while-loop example we did together in class today to write a python program that will print an x/y chart for the sin(x) and cos(x) functions for x from 0 to 360 degrees in increments of 15 degrees. The output should look similar to this: x , sin(x) , cos(x) ----------------------- 0.0 , 0.0 , 1.0 15.0 , 0.258819045103 , 0.965925826289 30.0 , 0.5 , 0.866025403784 . . . 330.0 , -0.5 , 0.866025403784 345.0 , -0.258819045103 , 0.965925826289 360.0 , -2.44929359829e-16 , 1.0 Name your program hw7.py and send it to me when you have it. Email if you run into problems and need help! Due: Monday, 9/15 --------------------------------------------- HW8: Make a program named cbrt.py that will allow the user to give a start, end, and step value with command line arguments and will print a table of values of the cube root of the numbers given (we did this together in class on Monday). Now, make a copy of that program and name it hw8.py. Modify hw8.py to find the 7/11 th power of each number given with the command line parameters. Finally use the pipe filter ( > ) to run hw8.py to save the 7/11th power for all the numbers from 1,183.5 to 22,456.7 in steps of 0.28 in an output file named out.txt. Email me a copy of that file. cbrt.py program we created in class on Monday Due: Wednesday, 9/24 --------------------------------------------- HW9: 1) Make a copy of the multi-function.py program we created in class today. Name the program hw9.py. Make the following changes to the program: Use four functions: f(x) = x^2, g(x) = x^(4/5) , h(x) = x^2 - 10.3x - 4 , i(x) = ( abs( sin(x) ) )^(1/2) 2) Run your program using 1 for the start value, 10000 (ten thousand) for the end value, and 0.15 for the step value. Pipe the output to a file named out.txt and send it to me. Attention!!! Notice that I made some slight changes in this problem from what I gave on the board in class today. The original end value created a file that was too big to send via email. Due: Wednesday, 10/1 --------------------------------------------- HW10: Use the program we created in class on Monday (num-diff.py). Name the copy hw10.py. Add another function (g(x) = x^2). Add another derivative function, say gder(x). Your output should add two columns of output to show the values for g(x) and g'(x) after x, f(x), and f'(x). Your program should take command-line parameters for the values of start, end, step, and delta. Due: Monday, 10/6 --------------------------------------------- HW11: Finish the program we started in class on Wednesday (10/08) named sum.py. Study for out first test! --------------------------------------------- Our first test will be Monday, 10/13. It will cover Python programming similar to all the class examples and homework we have done up through HW10. It will consist of two parts. The first part will be predict-the-output questions. It will be done on paper without a computer based solely on your knowledge of Python programming. I will give you a program, the input given when the program is run (if any) and you will predict the output.
The second part will consist of several problems where you will be asked to modify an existing program to change what it does. Then you will be asked to write a couple of programs similar to things I have asked you to write in the homework assignments. You will be able to use your computer and any existing programs for this part.
Make sure you bring your computer in good working order, fully charged (bring your ac adapter if you have any doubts). You will need to be confident in downloading a program example from the website like we do in class. You will also need to be comfortable in emailing me your finished program and/or output (using a pipe filter for the output) for each problem. Here are some practice pto probems. If you look in the dailywork link (link # 5 above) you will find the source code of each of the small practice problems. --------------------------------------------- HW12: Look at this file to take the place of our regular lecture on Wednesday, 10/15. Write the program as requested in the file (num-int.py) and email it to me before the start of class on Monday. It is very important that you complete this be then. We will use it for our lecture on Monday. If you have not done it I will give you a completed copy to use in class during Monday's lecture and will record a grade of zero for HW12. Due: Start of class on Monday, 10/20 or a grade of zero will be given. --------------------------------------------- HW13: Finish a trapezoid method for numerical integration of a function from a to b using n trapezoids. Use the trap-start.py program that we developed in class. Copy it to a program named trap.py. When your program is run it should be given a,b,n as command-line parameters and it should print the value of the integral of f(x) from a to b using the trapezoid method with n trapezoids. Sample output (using f(x) = x^2): a) python trap.py 1 2 10 output: The integral from 1.0 to 2.0 with 10.0 trapezoids is 2.335 b) python trap.py -1 3 20 output: The integral from -1.0 to 3.0 with 20.0 trapezoids is 9.36 Picture of notes on board at end of class Those of you who missed class (and those who were there but feel confused) might try using google with a search term like "numeric integration trapezoid method" to find more help. Due: Wednesday, 10/22 --------------------------------------------- HW14: Complete the problems on this handout. Due: Start of class on Monday, 10/27 or a grade of zero will be given. --------------------------------------------- HW15: Read and study section 5.3 on Simpson's Rules (pgs 280-285 in my text). We will write a program from this section in class tomorrow! Due: Wednesday, 10/29 --------------------------------------------- HW16: Make a copy your trap-n.py and name it simp.py. It should approximate the definite integral of a function (stored in your function, f in your program) from a to b using n panels (n must be an even number). The program should take the values of a, b, and n as command-line parameters. Example: If you want to evaluate the definite integral of sin(x) from 1 to 3 using 8 panels (x1, x2, ... x8, x9). python simp.py 1 3 8 Sample output from above command: a = 1.0 , b = 3.0 , n = 8.0 , h = 0.25 approximate integral = 1.53032826072 Another Example: python simp.py 2 5 32 Sample output from above command: a = 2.0 , b = 5.0 , n = 32.0 , h = 0.09375 approximate integral = -0.69980932265 A useful set of hints for the simpson's 1/3 rule program. --------------------------------------------- HW17: Here is the homework for Wednesday. If you haven't emailed me your simp.py program yet, be sure to do that too. Due: Wednesday, 11/5 --------------------------------------------- HW18: 1) Write a simpson's 3/8 rule base on your simp.py program (or based on mine which is located in the dailywork files (link 5 above). Name the program simpThreeEigths.py and email a copy of it to me. 2) Find the width of one portion of the curve above the x-axis for f(x) = x^3 * (sin(7x))^2 * cos(9x^2) for an x between 10.39 and 10.4. Give me a little information so that I can see how you arrived at your answer. 3) Use your simpThreeEigths.py program to find the definite integral of f(x) = x^3 * (sin(7x))^2 * cos(9x^2). Can you get the answer accurate to 5 decimal places? A picture of some lecture notes from 11/05 Here are some sample output printouts from a working simpson's 3/8 program with different functions: ----------------------------------------------------------- a = 1.0 , b = 2.0 , n = 30.0 , h = 0.0333333333333 f(x) = sin(x) approximate integral = 0.956449157179 ----------------------------------------------------------- a = 1.0 , b = 2.0 , n = 90.0 , h = 0.0111111111111 f(x) = sin(x) approximate integral = 0.956449142598 ----------------------------------------------------------- a = 1.0 , b = 3.0 , n = 30.0 , h = 0.0666666666667 f(x) = e^x * sin(x) approximate integral = 10.950159478 ----------------------------------------------------------- a = 1.0 , b = 3.0 , n = 90.0 , h = 0.0222222222222 f(x) = e^x * sin(x) approximate integral = 10.9501701811 ----------------------------------------------------------- Due: Start of class on Monday, 11/11 --------------------------------------------- HW19: 1) R&S pages 33-38 from the text. 2) Translate pgs 34-36 of the text into a working python program named bisection.py that will find the root of a function between two x-values. The textbook calls the given x-vales x1 and x2. Notice that a requirement for the bisection method to work is that f1 * f2 < 0. (This implies that f1 and f2 are of opposite sign and that, therefore, a root for the function lies somewhere between x1 and x2.) Due: Start of class, Wednesday, 11/12 --------------------------------------------- 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 ... Sep 4, 2014

Created on ... Aug 25, 2014