Numerical Analysis, Part B
联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
Numerical Analysis, Part B
Exercise 2 – Runge-Kutta Methods for ODEs
E1 consider the following initial value problem for a second-order equation:
y// = 2xy/ – , 1 < x < , y(1) = 1, y/ (1) = . (a) Rewrite this problem in standard form, as a system of rst-order ODEs. (b) The Butcher tableau (Eq. 1) de nes a Runge-Kutta method. Apply this method with one step of size h = to the initial value problem. Show all your work explicitly; i.e., do the entire computation on paper, not with a Java/C program or a Maple procedure. (Of course, you can use a pocket calculator or Maple for any oating point calculations required.) 0 1 2 (1) E2 Show that the Runge-Kutta method (Eq. 1) is of order O(h3 ). To that end, prove an analogue of Theorem 6.1 in the lecture notes for this particular method. Restrict yourself to the case of a single rst-order ODE, that is, to the case m = 1. E3 The C code ode_rungekutta.c is a rst-order ODE solver which applies a Runge-Kutta algorithm. It takes information on the interval [a, b] along with initial condition y(a) = α , and number of steps n to perform. It then computes an approximate solution to the ODE y/ (x) = f (x, y). Consider the ODE with (IVP) y + 2y/ = 2 - e-4z , 0 < x < 1, y(0) = 1. which has exact solution given by y(x) = 1 + e-4z - e-2z (a) Alter the function f and yexact in the code ode_rungekutta.c so that it solves the ODE. Compile and run the program and choose n = 10 for the number of steps. Write out the table as your solution. (b) Add an additional function called RK3 which implements the Runge-Kutta method in Eq. (1). Compile and run the program and choose n = 10 for the number of steps. Write out the table as your solution. (c) Advanced By using the two Runge-Kutta methods together, implement a basic adaptive step size (error correcting) technique. The function included in the code (stepAdjust) implements the formula q = ╱ ← 1/2 and returns a new value for h. Use a tolerance of T = 0.0001 and h = 0.01 to start (NOTE: you will have to change the do while loop so that it terminates once x > b = 1). Does the higher error rate that occurs for x e [0.3, 0.5] decrease to within the tolerance T


发表评论