H    Cash-Karp Runge-Kutta VBA Program for Two Ordinary Differential Equations

 Option Explicit Sub C_Kode() ′ *** FILENAME CKode *** ′ LAST MODIFIED 1/17/08 ′ TO SOLVE ORDINARY DIFFERENTIAL EQUATIONS USING ′ THE CASH-KARP (RUNGE-KUTTA-FEHLBERG) METHOD. INPUT ′ ARE INITIAL AND FINAL INDEPENDENT VARIABLES, INITIAL ′ DEPENDENT VARIABLES, STEP-SIZE, PRINT-FREQUENCY, AND ′ ERROR TOLERANCE. ′ THESE ARE IN THE SPREADSHEET. OUTPUT IS TO THE ′ SPREADSHEET AND A FILE. ′ X IS THE INDEPENDENT VARIABLE; Y AND Z ARE THE ′ DEPENDENT VARIABLES. ′ THE DERIVATIVES ARE DEFINED IN FUNCTIONS F (DY/DX) ′ AND G (DZ/DX). ′ THE ERROR IS CHECKED DURING PRINT-OUT. IF THE ERROR ′ IS AN ORDER OF MAGNITUDE DIFFERENT FROM THE TOLERANCE ′ THE STEP-SIZE IS ADJUSTED. Dim ...

Get Numerical Methods with VBA Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.