程序代写案例-CS 323

CS 323 Midterm Exam 1 - 2021 Fall
Haozhe Su
October 13, 2021
1. No collaborations.
2. Late submissions will only be accepted ONE day after the
due date. No
further late submissions will be accepted. All late submissions will be
taken 30 points over the total.
3. Submission includes a PDF file and a package of all CODES. You will
get litter or no credit if there is only a ’code’ package, or if the answer is
presented in the code files.
4. For theoretical problems, you would need to solve it by ’hand’; in other
words, the problem is easy and is solvable; and you may need MATLAB
and the like as a calculator or use libraries like matplotlib to generate the
plot, but you would definitely not need to program any specific algorithm.
Show ALL your work. You will get little or No credit for an answer that
is not explained. You can take pictures of your handwritten and attached
to the solution PDF file.
5. For Programming problems, follow the instructions carefully, do not use
system function to simplify coding unless the specific functions are men-
tioned in the problem descriptions.
Software: MATLAB / C++ / Python/ Java (or any language that you are
familiar)
Due date: Rutgers time: Oct 15 2021 11:59 pm
Problem 1: Theoretical assignment
1. Use Newton’s method to solve x + ex = 0 with an accuracy of 3 decimal
places. Please show the specific results at each iterative steps until it
converges.(Initial guess x0 = −1).
1
2. Use Secant method to solve x + ex = 0 with an accuracy of 3 decimal
places. Please show the specific results at each iterative steps until it
converges. (Initial guess x0 = −1, x1 = −1.1).
3. Plot absolute value of residual V.S. iterative steps.
Note:
1. This is a theoretical assignment, you need to solve it by hand. You can
use computer as a calculator or to generate plot if necessary.
2. The solution of Problem 1 should include:
(a) Question 1: write down each iterative step of Newton’s method, show
the specific evaluation to get xk. Show xk and the associated residual
at each step. (Points: 20)
(b) Question 2: write down each iterative step of Secant method, show
the specific evaluation to get xk. Show xk and the associated residual
at each step. (Points: 20)
(c) Question 3: only output one figure including both secant and New-
ton’s methods. x axis: iterative steps; y axis: absolute value of
residual at each step (You have got these values from Questions 1
and 2.) (Points: 5)
Problem 2: Programming assignment Define Aii = 40 and Ai+1,i =
Ai−1,i = −10 and the other entries in A are 0. i and j are the slot label at rows
and columns, respectively. For example, if A is a 5× 5 matrix, then
A =

40, −10, 0, 0, 0
−10, 40, −10, 0, 0
0, −10, 40, −10, 0
0, 0, −10, 40, −10
0, 0, 0, −10, 40
 (1)
Following the description, solve AX = B, where the sizes of A and B are
1000× 1000 and 1000× 1, respectively. All the entries in B are 1.
1. Suppose the tolerance is = 10−10. Use Jacobi, Gauss-Seidel, and SOR
method to solve AX = B. To demonstrate the results X, please do not
show the specific X, you only need to show L1, L∞, and L2 norms of X.
2. Plot L2 norm of residual vector V.S. iterative steps
Note:
1. You only need to solve the system with A1000×1000, the A5×5 is only for
demonstration.
2
2. Since SOR recovers Gauss-Seidel method, you are required to directly
program SOR method, and set ω = 1 for Gauss-Seidel simulation, and use
ω = 1.1 for SOR simulation.
3. Only use norm of residual ≤ Tolerance ( = 10−10) as the stop criteria;
4. The solution of Problem 2 should (only) include:
(a) Question 1: L1, L∞, and L2 norms of X solved by Jacobi, Gauss-
Seidel, and SOR methods. In total, 9 numbers. (ProgramA1000×1000–
Points: 12, all norms–Points: 18)
(b) Question 2: You are required to merge 3 curves into one single plot.
Each line represents the residual of one method. (Points: 20)
3

欢迎咨询51作业君
51作业君 51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: ITCSdaixie