(71B) Implicit Trapezoidal Integration Method for ODE - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (71B) Implicit Trapezoidal Integration Method for ODE (/thread-21349.html) |
(71B) Implicit Trapezoidal Integration Method for ODE - Namir - 02-23-2024 10:06 PM Implicit Trapezoidal Integration Method for ODE ================================================ Given f(x,y) and (x0,y0) as the initial point, xf as the final point, h is the integration step, toler as the tolerance value. The function to solve for y1 is: F(y1) = y1 - y0 - h/2*(f(x0,y0) + f(x1,y1)) The loop to calculate y at x=xf is: Code: While x0 < xf Instructions ============ 1) Define the differential equation at line 30. FNF should be a function of X and/or Y. 2) Edit the DATA statement in line 60 to contain the following values: 2.1) The value for the initial X. 2.2) The value for the initial Y. 2.3) The value for the final X. 2.4) The value for the integration step. 2.5) The tolerance value for solving the implicit step. 2.6) The number of results to skip storing in the results matrix R. Can be 0. 3) Press RUN. The program displays the current values of X. The program then displays the final value of Y. Finally the program displays the paired values of X and Y stored in the results matrix R. Example ======= given the ODE dy/dx = -2*y, x0=0, y0=1, xf=1, h=0.1, tolerance=1e-6. The matrix R stores the rows of (x, y) values, skipping every 0 values. Press RUN. The program displays X values and then the final Y value as "Y = 0.13443063275". Press [f][Cont] to view the paired values of X and Y stored in matrix R. The last value is the final value of Y. Program Listing =============== Code: 10 REM IMPLICIT TRAPEZOIDAL ODE RE: (71B) Implicit Trapezoidal Integration Method for ODE - Valentin Albillo - 02-25-2024 05:02 PM . Your 1,000th post, Namir, congratulations ! V. RE: (71B) Implicit Trapezoidal Integration Method for ODE - Namir - 02-25-2024 10:57 PM (02-25-2024 05:02 PM)Valentin Albillo Wrote: . Thank you .. thank you ... <bowns down> :-) Namir |