Python 3, còn gọi là Python 3000 hoặc Py3K: Dòng sẽ không hoàn toàn tương thích với dòng , tuy vậy có công cụ hỗ trợ chuyển đổi từ các phiên bản sang . Nguyên tắc chủ đạo để phát triển Python là "bỏ cách làm việc cũ nhằm hạn chế trùng lặp về mặt chức năng của Python". | 297 Shooting Method EXAMPLE The displacement v of the simply supported beam can be obtained by solving the boundary value problem dir 04 v d2 0atx 0andx L dx4 EIL dx2 where EI is the bending rigidity. Determine by numerical integration the slopes at the two ends and the displacement at mid-span. Solution Introducing the dimensionless variables x L EI y wLv transforms the problem to d4y d2y ệ y -X- 0 at ệ 0 and 1 dệ4 5 ỵ dị2 The equivalent first-order equations and the boundary conditions are the prime denotes d d Ệ The program listed next is similar to the one in Example . With appropriate changes in functions F x y initCond u and r u the program can solve boundary value problems of any order greater than 2. For the problem at hand we chose the Bulirsch-Stoer algorithm to do the integration because it gives us control over the printout we need y precisely at mid-span . The nonadaptive Runge-Kutta method could also be used here but we would have to guess a suitable step size h. As the differential equation is linear the solution requires only one iteration with the Newton-Raphson method. In this case the initial values U1 dy dỆ x 0and u2 d3y dỆ3 x 0 are irrelevant convergence always occurs in one iteration. usr bin python example8_4 from numpy import zeros array from bulStoer import 298 Two-Point Boundary Value Problems from newtonRaphson2 import from printSoln import def initCond u Initial values of y y y y use u if unknown return array u 0 u 1 def r u Boundary condition residuals--see Eq. r zeros len u X Y bulStoer F xStart initCond u xStop H y Y len Y - 1 r 0 y 0 r 1 y 2 return r def F x y First-order differential equations F zeros 4 F 0 y 1 F 1 y 2 F 2 y 3 F 3 x return F xStart Start of integration xStop End of integration u array Initial guess for u H Printout increment freq 1 Printout frequency u newtonRaphson2 r u X Y bulStoer F xStart initCond u xStop H printSoln X Y freq raw_input nPress return to exit Here