Solving scientific, engineering, and other problems often requires the
use of numerical methods and computers. This course presents various basic
numerical methods, discusses their mathematical properties, and provides
practice in computer programming.
All homework is to be turned in during class.
The "Practice" exercises are not to be handed in.
Final Exam. Friday, May 10, 2-5:00 p.m. in
ECJ 1.204
REVIEW
Comprehensive (perhaps emphasize material since the last exam). You may use your course notes and a calculator on this exam.
Office hours: M 5/6, 9-11:00; Tu 5/7, 9-11:00.
Problem Set 12. Due F 5/3.
SOLUTIONS
6.3 # 7; Practice 18
6.4 # 4a; Practice 10, 12
6.5 # 1a, 9(a,b); Practice 3a
Problem Set 11. Due F 4/26.
SOLUTIONS
6.1 # 12, 15; Practice 6a
6.2 # 10a, 14a; Practice 32
Exercise:
Matrix/Vector classes exercise.
matrix.h
and matrix.C
Problem Set 10. Due F 4/19.
SOLUTIONS
5.9 none; Practice 2a, 4a, 8
5.11 # 2(c,d), 14(c,d), 11 (use the backEuler code for 2 and 14: note the stated initial condition is incorrect [use the true solution]) (find LTE and stability for #11); Practice 9, 10, 15
Exercises:
1. Take 2 steps of Euler's method using h=1/2 for the system
u' = uv and v' = -u
u(0) = 2 and v(0) = 3
2. Convert the following third order differential equation into a system of three first order differential equations:
y''' = 2y'cos(y+y'')
3. Stability exercise.
Code:
C++ code backEuler.C and C++ code backEuler.h
Problem Set 9. Due F 4/12.
SOLUTIONS
5.4 # 2a, 6a, 10a, 14a; Practice 28
5.5 # 2a; Practice 5, 6
5.6 # 12; Practice 2a, 9
Exercise:
Write a code to implement both RK2 (the Midpoint method) and RK4.
Verify that your code is O(h2) for Midpoint and O(h4)
for RK4 by testing on 5.4 # 1c for 1<=t<=201. Start from a large h and
halve it a couple times. Determine the convergence rate by considering the
error at the final time. [Hint: you can use rkf.C below as a
template.]
Computer code:
rkf.C
The test program gives output for matlab plotting, using the code:
matlabPlot.h
matlabPlot.C
Simply (1) run the code, (2) run "matlab", (3) type "soln" (so matlab reads "soln.m").
You can also use the data in "soln.dat" to plot the solution using xmaple.
Exam 2. Friday, April 5.
REVIEW
SOLUTIONS
Sections 3.5, 4.1-4.5, 4.7, 5.1-5.3
You may use a calculator and a single page of notes on this exam.
90 A
86 A-
82 B+
78 B
74 B-
70 C+
66 C
62 C-
58 D+
54 D
50 D-
Mean 80.0 Median 81 Standard Deviation 12.9
Problem Set 8. Due F 3/29.
SOLUTIONS
5.1 # 4(b,d); Practice 1, 4(a,c), 6
5.2 # 2(a,b), 4(a,b); Practice 15
5.3 # 2(a,b), 4b
Exercise:
Compute trajectories of projectiles
You may use the the following computer code:
C++ code euler.C
matlabPlot.C
matlabPlot.h
Problem Set 7. Due F 3/22.
SOLUTIONS
4.4 # 12; Practice 20, 21
4.5 # 2a, 6a
4.7 # 1a, 2a, 6
Exercise:
Quadrature exercise
Computer code:
Download c++ code romberg.C
Problem Set 6. Due F 3/8.
SOLUTIONS
4.2 # 1b, 2b, 9; Practice 5, 10
4.3 # 2a, 4a, 6a, 8a, 16; Practice 18, 20
4.4 # 2a, 4a, 6a
Problem Set 5. Due F 3/1.
SOLUTIONS
3.5 # 2, 11; Practice 4(a,c), 6(c) [use the code!], 29
4.1 # 6(a), 8(a), 22, 27; Practice 20, 28
Exam 1. Friday, February 22.
SOLUTIONS
Sections 1.2-3; 2.1-4; 3.1-2,4.
You may use a calculator and a single page of notes on this exam.
90 A
86 A-
82 B+
78 B
74 B-
70 C+
66 C
62 C-
58 D+
54 D
50 D-
Mean 76.1 Median 77 Standard Deviation 15.9
Problem Set 4. Due F 2/15.
SOLUTIONS
3.2 # 3, 8; Practice 1(a,b), 12, 13
3.4 # 2(a,c), 6(a); Practice 4(a,c), 10
Exercise: Finish the following C++ code to evaluate the Lagrange polynomial
at any point. The code identifies what is missing.
interpolation.C
Correction: note that x[n-1] is not used in the formula
p(t) = coef[0] + coef[1]*(t-x[0]) + coef[2]*(t-x[0])*(t-x[1]) + ... + coef[n-1]*(t-x[0])*...*(t-x[n-2])
You may use the the following computer code:
neville.C
Problem Set 3. Due F 2/8.
SOLUTIONS
2.4 # 7, 8(a); Practice 2 [for (b) use x6 + 6x5+...], 4, 10, 11
3.1 # 2, 4; Practice 8, 19(b), 20, 21
Exercise: Write a C++ code to implement the Combined Newton-Bisection Method.
You may begin from the Netwon code. Here are the details:
exercise_newtonBisection.txt
Exercise: Convergence rates.
Use the code testRate.C
You may use the the following computer code:
newtonRaphson.C (modified Newton)
Problem Set 2. Due F 2/1.
SOLUTIONS
2.2 # 4*, 12(a,b)**; Practice 1, 20
2.3 # 2, 26; Practice 4
*Check by computing the derivative of g at 71/5=1.48.
**Use (a) g(x) = 2 + sin(x) and (b) g(x) = (2x+5)1/3
You may use the the following computer codes:
picard.C
newton.C
secant.C
Problem Set 1. Due F 1/25.
SOLUTIONS
1.2 # 17, 25; Practice 4, 21
1.3 # 1; Practice 3, 4, 9
2.1 # 6 (use a computer code), 14; Practice 16, 20
Exercise:
Recursion exercise
Download c++ code recursion.C
You may use the the following computer code:
Download c++ code bisection.C