Numerical Methods 2023

Numerical Methods 2023/4: Individual Project
• This work will count for 50% of your final mark for Numerical Methods.
• The mark breakdown is as follows.
Analysis 60 Working (and efficient) Maple code 30
Coding style 5 Overall presentation 5
• Store all files on One Drive or the M drive to protect against loss.
• Save your Maple work regularly. Executing incorrect codes may cause Maple to become trapped in an infinite loop. If this happens, you can try pressing the interrupt button ( ), but you may be forced to close the application and reload your work.
• Submit your work as a single pdf file. See the project guidance notes for instructions on merging and rearranging pdf files.
• Invalid submissions (e.g. files in formats other than pdf) will be deleted. Groups that make invalid submissions will be given another chance to submit, but this will be treated as late, and subject to standard university penalties (5% deduction for each day, and a mark of zero after five days).
• You must answer the question assigned to you. No marks will be awarded for answer- ing other questions.
Individual project G 1 CONTINUED. . .
浙大学霸代写 加微信 cstutorcs
Throughout this question, cn represents the leading coefficient in the Legendre polynomial Pn(t) (i.e. the coefficient of tn). You may assume that cn > 0 and that Legendre polynomials (as defined in the lecture notes) are unique.
(i) Explain why
(ii) Use the substitution s = −t in the definition of Pn(t) to prove that
Pn(−t) = (−1)nPn(t).
cn Pn(t)t dt= .
(b) Let αn be a constant and consider the function
Qn+1(t) = tPn(t) + αnPn−1(t).
(i) Determine the set of nonegative integers r for which Z1r
Qn+1(t)t dt = 0. −1
(ii) By considering the case r = n − 1, deduce that Pn(t) satisfies the recurrence relation βnPn+1(t) = tPn(t) + αnPn−1(t),
provided αn and βn satisfy appropriate relationships with the coeffecients cn. Write down these relationships.
(iii) Use explicit formulae for the Legendre polynomials to find the first few constants αn and βn, and deduce formulae for general n. Assuming your deductions are correct, show that
(n + 1)Pn+1(t) = (2n + 1)tPn(t) − nPn−1(t).
Use Maple to avoid tedious algebra. To obtain cn for a nonnegative integer n try
c[n] := coeff( simplify( LegendreP( n , ’x’ ) ) , ’x’ , n ) :
(c) The function
Sˆn(t) = Z 1 Pn(t) − Pn(x) dx −1 t−x
satisfies the same recurrence relation as Pn(t) (proof: exercise for fun).
(i) Find Sˆ0, Sˆ1 and Sˆ2.
(ii) Let tk represent one of the zeros of Pn(t), and define
 P n ( t ) Pˆ n ( t ) =  t − t k
if t ̸= tt, Pn′(tk) ift=tk.
Apply one step of n-point Gaussian quadrature to the integral Z1ˆ
Pn(t) dt, −1
and hence show that the weight corresponding to the node t = tk is given by
w k = Sˆ n ( t k ) . P n′ ( t k )
Individual project G 2
CONTINUED. . .
CS Help, Email: tutorcs@163.com
(i) Write a Maple procedure which takes as its argument a positive integer n and returns as its results the nodes and weights of the n-point Gaussian quadrature rule for the interval [−1, 1]. The procedure should use the recurrence relation from the above analysis to obtain Pn(t) and Sˆn(t), solve Pn(t) = 0 to obtain the nodes and then use the result of part (c)(ii) to find the weight.
Note: if f is an expression for polynomial of degree n, then
rts := Array( [ fsolve( f ) ] ) ;
will produce an array containing all of its (real) roots. If f is a function then try rts := Array( [ fsolve( f( ’x’ ) ) ] ) ;
(ii) Test your procedure for the case n = 3, and display the results for the cases n = 10 and n = 15 as well. Check that the weights add up to 2 in each case.
Individual project G 3 END
程序代写 CS代考 加微信: cstutorcs