TAILIEUCHUNG - Numerical Methods in Engineering with Python Phần 7

Python ra đời kế thừa từ Python và Python . Bản quyền của phiên bản này được đổi thành Python Software Foundation License. Từ thời điểm này trở đi, Python thuộc sở hữu của Python Software Foundation (PSF), một tổ chức phi lợi nhuận được thành lập theo mẫu Apache Software Foundation. | 253 Runge-Kutta Methods y y 0 y 1 .y n-1 . x y initial conditions. xStop terminal value of x. h increment of x used in integration. F user-supplied function that returns the array F x y y 0 y 1 .y n-1 . from numpy import array def integrate F x y xStop h def run_kut4 F x y h Computes increment of y from Eqs. K0 h F x y K1 h F x h y K0 K2 h F x h y K1 K3 h F x h y K2 return K0 K1 K2 K3 X Y X. append x Y. append y while x xStop h min h xStop - x y y run_kut4 F x y h x x h X. append x Y. append y return array X array Y EXAMPLE Use the second-order Runge-Kutta method to integrate y sin y y 0 1 from x 0 to in steps of h . Keep four decimal places in the computations. Solution In this problem we have F x y sin y so that the integration formulas in Eqs. are K0 hF x y sin y K1 hF x h y 1 K J f y 2 Ko j y x h y x K1 254 Initial Value Problems We note that y 0 1 the integration then proceeds as follows K0 sin K1 sin i 2 i y K0 sin K1 sin i 2 i y and so on. A summary of the computations is shown in the following table. x y K0 K1 The exact solution can be shown to be x y ln csc y cot y which yields x . Therefore up to this point the numerical solution is accurate to four decimal places. However it is unlikely that this precision would be maintained if we were to continue the integration. Because the errors due to truncation and roundoff tend to accumulate longer integration ranges require better integration formulas and more significant figures in the computations. EXAMPLE Solve y x y 0 0 y 0 1 from x 0 to 2 in increments of h with the Runge-Kutta method of order 4. This problem was solved by the Taylor series .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.