The syllabus for this course is here.
We will be using Mathematica for the first third of this course, both for lecture and for homework. Mathematica is available only in the Briggs 419 computer lab. The lab will be open during regular building hours and from 7-10 PM Sunday - Thursday and 1-4 on Sundays.
All of the Mathematica files that I am providing below are in the form of Mathematica notebooks. To download these files, right click on the links provided and select the option to download the file to the local disk. You can then open those files in Mathematica. If you are working at a computer that does not have Mathematica installed, you can use the Mathematica Player from Wolfram Research to read these files instead. You can download the Mathematica Player from http://www.wolfram.com/products/player/.
I showed some introductory examples that demonstrate how to use Mathematica to do simple calculations.
I talked about functions in Mathematica.
I introduced iteration as a problem-solving strategy. The textbook has some discussion of iteration in chapter 4. Here are lecture notes for this topic.
Problems 3.15, 3.18, 3.19, 3.20, 4.5, 4.12, 5.1, 5.3, 5.6, and 5.8. These problems are due by the start of class on Wednesday, January 14. To submit your homework, please put all of your work in one Mathematica notebook file and email the file to me at greggj@lawrence.edu. Please use section heading cells to label the individual problems and use text cells where appropriate to provide discussion of your work.
Chapter 6: lecture notes.
Chapter 7: lecture notes.
Problems 6.1, 6.2, 6.4, 6.9, 6.11, 7.6, 7.12, and 7.17. These problems are due on Friday, January 23.
Chapter 9: lecture notes.
Problems 9.7, 9.8, 9.13, and 9.18. (Note: some of these problems refer to the bisection function shown in Figure 9.10 in the text. That figure contains a misprint: the local variable list in the Module is missing the curly braces it needs. The binaryRoot function I showed in my lecture notes is correct, and you are welcome to do these problems using that function instead.) These problems are due on Monday, January 26.
We began discussing the C programming language. The development environment we will use for the C and C++ portions of this course is Visual C++ 2008. The Express Edition is a free version of Visual C++ that is available for download, so you can install it on your own computer if you wish. Otherwise, Visual C++ is available on the machines in Briggs 419. Here are some lecture notes that explain how to set up a project in Visual C++ and start programming in C. The C language material I covered today comes from chapter 10 and 11 in the text.
Homework is problems 10.15 and 11.18. To do these problems you will need the source code for the horizon.c program.
Chapter 12
Problems 10.15, 11.18, 12.7, and 12.14. These problems are due on Friday, January 30.
Chapter 13. Homework is problems 13 and 14 from the end of chapter 13. To do this assignment you will need this code as a starting point. I also showed an additional example, a function to compute the number of days in a month.
Chapter 14: homework is problems 7 and 15. To do this assignment you will need this code as a starting point.
In addition to the material from chapter 14, I also showed two examples. The first is a short program that solves the block-stacking problem from chapter 4. The second is an alternative implementation of the bisection method.
Problems 13.13, 13.14, 14.7, and 14.15. These problems are due on Friday, February 6.
Here are some sample questions from previous years, the midterm, and the solutions.
I constructed an example program to compute the date for a given number of days forward from a starting date.
Chapter 15. In addition to the examples in the text, I also developed a program that uses Simpson's rule to estimate an integral.
15.12, and modify this project by adding a third function to Integ.c that uses Simpson's rule to estimate the value of the integral. Modify Compare.c to compare all three methods. In implementing Simpson's rule, try to optimize your implementation of Simpson's rule in the same way that the text optimized the code for the Trapezoid rule. (Get rid of redundant function calls and replace the while loop with a for loop.) These two problems are due on Wednesday, February 11.
I introduced arrays and showed a version of the Simpson's Rule example that uses arrays. We covered chapter 17.
Chapter 18
I created a simple example program that reads a list of integers from a file, stores them in an array, and then prints the contents of the array.
Problems 17.5, 17.10, 17.11, 17.16, and 18.10. To do these problems you will need heat6.c and heat11.c. For problem 17.11, diagnose the problem caused by the change in 17.10 and repair it without bringing back the nxt array. In addition to these problems, also write a program that reads a list of integer quiz scores from a file and prints a grade distribution (how many people had scores in the range 90-100, how many in the range 80-89, and so on). The problems are due on Monday, February 23.
I showed another extended example using files and arrays. This example computes a regression line for a set of data points. Here is an archive containing lecture notes, source code, and data files for this example.
I began the discussion of C++ by working through an extended example, Newton's method with complex numbers. Here are lecture notes and project folders for the three different versions of the program I showed in class: version one, version two, and version three.
Problem 1: Write a program that reads an unordered list of integers from a text file, finds the smallest and largest numbers in the list, and then saves a list of all the integers between the smallest and the largest that do not appear in the original list to a second text file. To solve this problem, I suggest that you write the following functions
int smallest(int A[],int size); int largest(int A[],int size); int location(int A[],int size,int x);
where smallest returns the smallest integer in the array A, largest returns the largest integer in A, and location returns the first index i at which A[i] is equal to x or returns -1 if x is not in A.
Problem 2: Write a program that uses interval arithmetic to compute the distance to the horizon as in chapter 5. Here are specific requirements:
You can use the final version of the complex Newton method program as a guide to help you write these functions.
These two problems are due on Friday, February 27.
I showed two solutions to the extra problem in homework set seven.
I introduced C++ vectors, which are C++'s attempt to overcome some of the limitations of arrays. Here are lecture notes covering the basics of vectors in C++.
The second midterm exam will be held on Wednesday, March 4. This exam will cover all of the C material in the course. You will be allowed to bring a single page of notes to the exam. I have prepared a set of sample questions with solutions to help you prepare for the exam.
I talked about numerical methods for solving some kinds of differential equations and developed a program that implements some of these methods.
Problem 1: do the homework exercise found at the end of the lecture notes on vectors.
Problem 2: do the exercise found at the end of the lecture notes on differential equations.
These two problems are due on Friday, March 6.
I showed an extended example that demonstrates how to sort an array of integers and solve the 'find the missing numbers' problem from problem set 8.
Problem 2 Do the programming problem at the end of the lecture notes on member functions.
These two problems are due on Friday, March 13.
Member functions in C++: here are lecture notes. After developing the Polynomial class, I showed two applications. The first application was polynomial interpolation. Here are lecture notes and source code for this example. The second application was a program that allowed the user to enter a polynomial from the keyboard and then use Newton's method to search for a root.
I gave a bonus lecture on recursion as a problem solving strategy and showed Quicksort, a very efficient sorting algorithm that uses recursion. Here is a project containing source code for Quicksort.
The final exam will be held at 8:30 on Thursday, March 19. The final will cover C++. As on the second midterm, you will be allowed to bring in a single page of notes to use on the exam. Here are some sample questions with solutions to help you prepare.