Practice_Problems_Weeks_2-13_2024

.pdf

School

The University of Sydney *

*We aren’t endorsed by this school

Course

2000

Subject

Mathematics

Date

Apr 3, 2024

Type

pdf

Pages

30

Uploaded by MinisterCrocodile2917

Report
Week 2 Practice Problems 1. Given ln(9.0) = 2.1972, ln(9.5) = 2.2513 and ln(11) = 2.3979, use the method of Lagrange polynomials to estimate ln(9.2). 2. Using least squares, fit a line to the points (-1, 1), (-0.1, 1.099), (0.2, 0.808), (1, 1). 3. Given u = x 2 y 2 , calculate . x u u x = 4. Given u = e x cos( y ), calculate u y . 5. Show that the above two functions for u are solutions to the equation u xx + u yy = 0. Is the sum of the two functions also a solution? Substantiate your answer. 6. Classify each of the following partial differential equations and describe its behaviour in time and space: (a) u tt + u yy = 0 (b) u xx u t = 0 (c) u xx u tt = 0 7. For an arbitrary function 𝑢𝑢 ( 𝑥𝑥 ) , plot the points ( 𝑥𝑥 𝑖𝑖 , 𝑢𝑢 𝑖𝑖 ) , ( 𝑥𝑥 𝑖𝑖−1 , 𝑢𝑢 𝑖𝑖−1 ) , ( 𝑥𝑥 𝑖𝑖−2 , 𝑢𝑢 𝑖𝑖−2 ) , ( 𝑥𝑥 𝑖𝑖+1 , 𝑢𝑢 𝑖𝑖+1 ) , ( 𝑥𝑥 𝑖𝑖+2 , 𝑢𝑢 𝑖𝑖+2 ) , assuming all points are equally spaced by ∆𝑥𝑥 . Label the axes and all values on the 𝑥𝑥 and 𝑢𝑢 axes. 8. The Taylor series allows you to express the value of a function at location B in terms of the value of the function at location A and the derivatives of the function at location A . Write out the Taylor series expansion for the following function values, using 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 as the reference location (i.e. location A ): (i) 𝑢𝑢 𝑖𝑖+1 (ii) 𝑢𝑢 𝑖𝑖+2 (iii) 𝑢𝑢 𝑖𝑖−1 (iv) 𝑢𝑢 𝑖𝑖−3 (v) 𝑢𝑢 𝑖𝑖 9. Repeat Q8 but this time considering 𝑥𝑥 = 𝑥𝑥 𝑖𝑖+1 as the reference location. 10. Suppose want to estimate the gradient of a function 𝑓𝑓 at the point 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 using the function value at 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 and the function value at 𝑥𝑥 = 𝑥𝑥 𝑖𝑖+1 . Mathematically we can write this as: 𝜕𝜕𝑓𝑓 𝜕𝜕𝑥𝑥 𝑖𝑖 ≈ 𝐴𝐴𝑓𝑓 𝑖𝑖 + 𝐵𝐵𝑓𝑓 𝑖𝑖+1 Note a few things: We have used the ‘approximately equals’ sign ( ) rather than the equals sign ( = ) because this is an approximation to the gradient, it is not exact; The notation of the subscripted 𝑖𝑖 means this is at location 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 . Similarly the subscripted 𝑖𝑖 + 1 indicates that it is at location 𝑥𝑥 = 𝑥𝑥 𝑖𝑖+1 ; We use 𝐴𝐴 and 𝐵𝐵 as the unknown weighting of each point – these are what we need to find. The linear combination of function values on the RHS is referred to as a ‘stencil’. We could use any stencil we want. Different stencils are different combinations of function values. In this particular case, our stencil is just the value of the function at the location where we are interested in computing the gradient ( 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 ), and the value of the function at the next location ( 𝑥𝑥 = 𝑥𝑥 𝑖𝑖+1 ). This stencil is referred to as a ‘forward’ approximation since we are approximating the gradient at a point using the value at that point and the value forward of that point. Use the Taylor Series to determine 𝐴𝐴 and 𝐵𝐵 .
11. The stencil used in Q10 gives us an approximation to the gradient. However, we can write: 𝜕𝜕𝑓𝑓 𝜕𝜕𝑥𝑥 𝑖𝑖 = 𝐴𝐴𝑓𝑓 𝑖𝑖 + 𝐵𝐵𝑓𝑓 𝑖𝑖+1 + 𝜀𝜀 where 𝜀𝜀 is the residual error in our approximation (notice how when we account for 𝜀𝜀 the becomes = ). The Taylor series can give us the size of 𝜀𝜀 , which is very helpful because it tells us how accurate our approximation is. We obtain 𝜀𝜀 as the leading error term in the Taylor series expansion of the stencil. Using your working from Q4, what is the leading error term in the approximation? 12. Which one of the following stencils will give you a consistent estimate of the first derivative of 𝑓𝑓 at 𝑥𝑥 = 𝑥𝑥 𝑖𝑖 ? A. 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖 𝜕𝜕 𝑖𝑖−3 +2𝜕𝜕 𝑖𝑖−1 −3𝜕𝜕 𝑖𝑖+1 3Δ𝜕𝜕 B. 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖 𝜕𝜕 𝑖𝑖−1 +2𝜕𝜕 𝑖𝑖+1 +𝜕𝜕 𝑖𝑖+2 2Δ𝜕𝜕 C. 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝑖𝑖 𝜕𝜕 𝑖𝑖−2 −2𝜕𝜕 𝑖𝑖−1 +𝜕𝜕 𝑖𝑖+1 Δ𝜕𝜕 13. For the function 𝑓𝑓 ( 𝑥𝑥 ) = ln (1 − 𝑥𝑥 ) , which of the following is the correct expression for 𝑓𝑓 ( 𝑥𝑥 + Δ𝑥𝑥 ) using a Taylor series expansion? A. 𝑓𝑓 ( 𝑥𝑥 + Δ𝑥𝑥 ) = ln(1 − 𝑥𝑥 ) Δ𝜕𝜕 1−𝜕𝜕 ( Δ𝜕𝜕 ) 2 2 !( 1−𝜕𝜕 ) 2 2 ( Δ𝜕𝜕 ) 3 3 !( 1−𝜕𝜕 ) 3 6 ( Δ𝜕𝜕 ) 4 4 !( 1−𝜕𝜕 ) 4 + B. 𝑓𝑓 ( 𝑥𝑥 + Δ𝑥𝑥 ) = ln(1 − 𝑥𝑥 ) Δ𝜕𝜕 1−𝜕𝜕 ( Δ𝜕𝜕 ) 2 2 !( 1−𝜕𝜕 ) 2 ( Δ𝜕𝜕 ) 3 3 !( 1−𝜕𝜕 ) 3 ( Δ𝜕𝜕 ) 4 4 !( 1−𝜕𝜕 ) 4 + C. 𝑓𝑓 ( 𝑥𝑥 + Δ𝑥𝑥 ) = ln(1 − 𝑥𝑥 ) + Δ𝜕𝜕 1−𝜕𝜕 + ( Δ𝜕𝜕 ) 2 2 !( 1−𝜕𝜕 ) 2 + 2 ( Δ𝜕𝜕 ) 3 3 !( 1−𝜕𝜕 ) 3 + 6 ( Δ𝜕𝜕 ) 4 4 !( 1−𝜕𝜕 ) 4 + 14. Derive a stencil to calculate the derivative u x at point i -2 using the known value of the points u i , u i -1 , u i -2 . 15. Determine the truncation error of the stencil in Q14 and comment on the order of accuracy. 16. Suppose we’ve collected some noisy experimental data points, shown as circles in the figure. We’ve then chosen an interpolation approach (blue line) which ensures we pass exactly through every point. The interpolation approach also ensures that at every point along the curve we can compute a first and second derivative. Which of the following best describes the interpolation shown in the figure? A. We have fitted the underlying signal very well and can compute the gradient at any point we want. B. We have fitted the noise rather than the underlying signal. C. We have most likely used a second-order Lagrange polynomial fit. D. None of the above.
17. Suppose the interpolation shown in Q8 was obtained using a series of second-order Lagrange polynomial fits. For how many of the points would you expect there to be an undefined gradient? 18. Which of the following statements is true (select any that apply): A. Least squares fitting is very useful for fitting a line or low-order polynomial to noisy data in order to estimate the underlying signal. B. Least squares fitting is typically not reliable for high-order fits to noisy data. C. A low-order least squares fit is always a better option than a low-order (e.g. cubic) spline since it assumes data are noisy. D. Piecewise constant, piecewise linear or second-order Lagrange interpolation would be perfectly fine if we only want to integrate a set of data points and are not interested in computing gradients. x U
Week 3: Fourier Series Examples and Practice To practice the concept of representing functions using Fourier series, we’ll start with several examples that you can check against the UoS data sheet. Then we’ll cover some further examples that have been simulated in the FOURIER DEMOS you can download from our Canvas site – this will enable you to visualise the solutions you derive. Question 1 The odd function shown can be represented as a Fourier sine series. Use the appropriate Euler formula from the data sheet to calculate the Fourier coefficients of the sine series, and then verify your answer against the table on the data sheet. Question 2 The odd function shown can be represented as a Fourier sine series. Use the appropriate Euler formula from the data sheet to calculate the Fourier coefficients of the sine series, and then verify your answer against the table on the data sheet. Question 3 The odd function shown can be represented as a Fourier sine series. Use the appropriate Euler formula from the data sheet to calculate the Fourier coefficients of the sine series, and then verify your answer against the table on the data sheet.
Question 4 The even function shown can be represented as a Fourier cosine series. Use the appropriate Euler formula from the data sheet to calculate the Fourier coefficients of the cosine series. Question 5 The even function shown can be represented as a Fourier cosine series. Use the appropriate Euler formula from the data sheet to calculate the Fourier coefficients of the cosine series.
FURTHER EXAMPLES WITH SIMULATIONS Now that you’ve done a few examples to practice using the Euler formulae to obtain Fourier series coefficients for odd and even functions, we’ll demonstrate a few more examples; these examples are used in the FOURIER DEMOS which you can download from our Canvas site. You’ll get the most out of these examples by running the FOURIER DEMOS alongside so that you can visualise what is happening. EXAMPLE 1: Calculate the Fourier sine series representing the odd square wave shown in Figure 1 . Figure 1 . Odd square wave, amplitude 1. SOLUTION Since 𝑓𝑓 ( 𝑥𝑥 ) is an odd function which is periodic over the interval [ −𝐿𝐿 , 𝐿𝐿 ] , it can be represented as a Fourier sine series. The Fourier coefficients for this series are given by the Euler formula on the data sheet: 𝐵𝐵 𝑛𝑛 = 1 𝐿𝐿 𝑓𝑓 ( 𝑥𝑥 ). sin 𝑛𝑛𝑛𝑛𝑛𝑛 𝐿𝐿 � 𝑑𝑑𝑥𝑥 𝐿𝐿 −𝐿𝐿 (1) where 𝑓𝑓 ( 𝑥𝑥 ) is our square wave function shown in Figure 1. Since both 𝑓𝑓 ( 𝑥𝑥 ) and sin 𝑛𝑛𝑛𝑛𝑛𝑛 𝐿𝐿 are odd functions, the integrand is even (i.e. odd x odd = even). Whenever you integrate an even function over symmetric limits you can simplify the integral by integrating from 0 to L and doubling the result, viz: 𝐵𝐵 𝑛𝑛 = 2 𝐿𝐿 ∫ 𝑓𝑓 ( 𝑥𝑥 ). sin 𝑛𝑛𝑛𝑛𝑛𝑛 𝐿𝐿 � 𝑑𝑑𝑥𝑥 𝐿𝐿 0 (2) Now we can go ahead and substitute 𝑓𝑓 ( 𝑥𝑥 ) and perform the integration: 𝐵𝐵 𝑛𝑛 = 2 𝐿𝐿 (1). sin 𝑛𝑛𝑛𝑛𝑛𝑛 𝐿𝐿 � 𝑑𝑑𝑥𝑥 𝐿𝐿 / 2 0 + 2 𝐿𝐿 ( 1). sin 𝑛𝑛𝑛𝑛𝑛𝑛 𝐿𝐿 � 𝑑𝑑𝑥𝑥 𝐿𝐿 𝐿𝐿 / 2 (3) = 2 𝑛𝑛𝑛𝑛 cos 𝑛𝑛𝑛𝑛𝑥𝑥 𝐿𝐿 �� 0 𝐿𝐿 / 2 + 2 𝑛𝑛𝑛𝑛 cos 𝑛𝑛𝑛𝑛𝑥𝑥 𝐿𝐿 �� 𝐿𝐿 / 2 𝐿𝐿 = 2 𝑛𝑛𝑛𝑛 cos 𝑛𝑛𝑛𝑛 2 � − 1 + 2 𝑛𝑛𝑛𝑛 cos( 𝑛𝑛𝑛𝑛 ) cos 𝑛𝑛𝑛𝑛 2 ��
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help