Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Math 104A Homework #1 Instructor: Xu Yang General Instructions: Please write your homework papers neatly. You need to turn in both your codes and descriptions
Math 104A Homework #1 Instructor: Xu Yang General Instructions: Please write your homework papers neatly. You need to turn in both your codes and descriptions on the appropriate runs you made by compressing and emailing them to TA with your name and ID number as the file name. Write your own code, individually. Do not copy codes! 1. Review and state the following theorems of Calculus (see for example 1.1 and 1.2 in the textbook): (a) The Intermediate Value Theorem. (b) The Mean Value Theorem. (c) Rolles Theorem. (d) The Mean Value Theorem for Integrals. (e) The Weighted Mean Value Theorem for Integrals. 2. Write a computer code to implement the Composite Trapezoidal Rule quadrature \u0012 \u0013 1 1 Th [f ] = h f (x0 ) + f (x1 ) + ... + f (xN 1 ) + f (xN ) , 2 2 (1) to approximate the definite integral Z I[f ] = b f (x)dx, (2) a using the equally spaced points x0 = a, x1 = x0 + h, x2 = x0 + 2h, . . . , xN = b, where h = (b a)/N . Make sure that all your codes have a preamble which describes the purpose of the code, all the input variables, the expected output, your name, and the date of the last time you modified the code. 2 3. To test your code, take f (x) = xex in [0, 1], compute the error |I[f ] Th [f ]| for h = 1/10, 1/20, 1/40, and verify that Th has a convergent trend at the expected quadratic rate. All course materials (class lectures and discussions, handouts, homework assignments, examinations, web materials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of Prof. Hector D. Ceniceros. 1 4. Consider the definite integral I[e x2 1 Z= 2 ex dx, (3) 0 We cannot calculate its exact value but we can compute accurate approximations to it using 2 Th [ex ]. Let 2 q(h) = 2 Th/2 [ex ] Th [ex ] Th/4 [ex2 ] Th/2 [ex2 ] . (4) Using your code, find a value of h for which q(h) is approximately equal to 4. (a) Get an 2 2 approximation of the error, I[ex ] Th [ex ], for that particular value of h. (b) Use this error approximation to obtain the extrapolated, improved, approximation 2 2 Sh [ex ] = Th [ex ] + 2 \u0011 4\u0010 2 2 Th/2 [ex ] Th [ex ] . 3 2 (5) 2 Explain why Sh [ex ] is more accurate and converges faster to I[ex ] than Th [ex ]. 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started