Final_Problem 4: (Extra credits for efficient methods) (1) Why trapezoidal rule is more accurate than it should be? Since the function under consideration is periodic, the trapezoidal rule gives much more accuracy than usually (2nd order). The reason is very similar to problem 1 (c) of the final exam. In problem 1(c), the usual error is C_2 h^2, but since f'(0)=f'(1), the constant C_2 =0, thus the error was C_4 h^4. (In problem 1(c), C_4 is not zero). In this problem, C_4 is proportional to f'''(2*pi)-f'''(0)=0 (since f is periodic). So the error becomes C_6 h^6, but again C_6 is proportional to f'''''(2*pi)-f'''''(0), which is also 0. In this case, the error is actually e_n = A exp(-B n) for some constant A and B. This is called 'spectral accuracy'. (2) How to find numerical with high accuracy? In matlab, you can use 'vpa' to get more correct floating points digits. (That is, more accurate than double-precision arithmetics). The following is the 40 digits numerical solution with n=512. First we choose a big n to get a high accurate approximation n=512 => T_512 = 3.708149354602743836867700694390520092430 We can think of T_512 as our exact solution and use it to observe how fast the convergence is with n=16, 32, 64, ... ------------------------------------------------------------ (3) Trapezoidal Rule results with vpa (If you turn off vpa, you'll get first 15-16 digits of vpa result). n=16 => T_16 = 3.708150455534615732334428258707085766775 n=32 => T_32 = 3.708149354603333215991803457237450431756 n=64 => T_64 = 3.708149354602743836867700930355463277037 When n=16, the first 5 digits are the same as n=32, 64 results When n=32, the first 12 correct digits are the same as n=64 results. From these results, you should be able to conclude that n=32 already has 10 correct digits. You can compare the n=64 result with n=512, you'll find that first 25 digits are correct. ------------------------------------------------------------ (4) Check order of accuracy using T_512 as exact solution: log_2((T_512-T_16)/(T_512-T_32)) = 20.8330 log_2((T_512-T_32)/(T_512-T_64)) = 41.1838 Conjecture: Try to find T_128 and T_512 with 100 digits using vpa. Then check whether log_2((T_512-T_64)/(T_512-T_128)) ~ 82.xxx ? See if the guess is correct.