(15C) Runge-Kutta 4th order method
|
06-23-2015, 06:25 PM
(This post was last modified: 06-15-2017 01:18 PM by Gene.)
Post: #1
|
|||
|
|||
(15C) Runge-Kutta 4th order method
This program is from a post by Valentin Albillo in the old forum:
Small HP calc versus MATHEMATICA ! [LONG] Code: 001 - 42,21,11 LBL A 013 - 44 3 STO 3 025 - 45 1 RCL 1 037 - 32 2 GSB 2 Example: Quote:Given the equation \({y}' = x^2 + y^2\), with \(y(0) = 0\), find an accurate value for \(y(2)\). It turns out that there is a singularity near \(x = 2\) which can be removed using a change of variable: \(y = \tan(z)\) This leads to: \({z}' = \frac{x^2 + \tan^2(z)}{1 + \tan^2(z)}\) The initial condition is: \(z(0) = 0\) This differential equation is programmed under LBL C: Code: 046 - 42,21,13 LBL C In RAD mode, using \(h = 0.1\), then \(h = 0.05\), we get: \(\begin{array}{l l l} \hline\hline x & y (h=0.1) & y (h=0.05) \\ \hline 0 & 0 & 0 \\ 1 & 0.3368811 & 0.3368813 \\ 1.7 & 1.2463033 & 1.2463031 \\ 1.8 & 1.3606417 & 1.3606412 \\ 1.9 & 1.4666491 & 1.4666485 \\ 2.0 & 1.5676491 & 1.5676489 \\ \hline \end{array} \) This clearly shows that the singularity has been effectively removed, so we've got: z(2) = 1.5676489 and thus: y(2) = tan(z(2)) = 317.7225457 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)