Mathematics Source Library
C & ASM

 Home Differential Equations Home Adam's Home Basforth 3 - Moulton 2 Steps Basforth 4 - Moulton 3 Steps Basforth 5 - Moulton 4 Steps Basforth 6 - Moulton 5 Steps Basforth 7 - Moulton 6 Steps Basforth 8 - Moulton 7 Steps Basforth 9 - Moulton 8 Steps Basforth 10 - Moulton 9 Steps Basforth 12 - Moulton 11 Steps Basforth 14 - Moulton 13 Steps Basforth 16 - Moulton 15 Steps Basforth 18 - Moulton 17 Steps Basforth 20 - Moulton 19 Steps

The Adams-Bashforth 10 steps method and Adams-Moulton 9 steps method form a predictor-corrector multistep procedure for approximating the solution of a differential equation given historical values.

### Function List

• int Adams_10_Steps( double (*f)(double, double), double y[ ], double x0, double h, double f_history[ ], double *y_bashforth, double tolerance, int iterations )

This function uses the Adams-Bashforth method and Adams-Moulton method to estimate the solution of the initial value problem, y' = f(x,y); y(x0) = y[0], at x = x0 + h, where h is the step size and f_history[ ] is the array containing the values of the function f(x,y) evaluated at the starting values f(x0 - i*h,y(x0 - i*h)) for i = 1, …, 9. The Adams-Moulton method terminates either when successive estimates are within tolerance of each other or when the number of iterations exceeds iterations. Upon return, the y[1] contains the estimate of y(x0 + h), y_bashforth contains the estimate of y(x0 + h) using the Adams-Bashforth algorithm, the array f_history[ ] has been updated for a subsequent call to this function, and the function itself returns the number of iterations used in the Adams-Mouton procedure.

• double Adams_Bashforth_10_Steps( double y, double h, double f_history[ ] )

This function uses Adams-Bashforth 10 step method to return the estimate of the solution of the initial value problem, y' = f(x,y); y(x0) = y[0], at x = x0 + h, where h is the step size and f_history[ ] is the array containing the values of the function f(x,y) evaluated at the starting values f(x0 - i*h,y(x0 - i*h)) for i = 0, …, 9.

• int Adams_Moulton_9_Steps( double (*f)(double, double), double y[ ], double x, double h, double f_history[ ], double tolerance, int iterations )

This function uses the Adams-Moulton 9 step method to estimate the solution of the initial value problem, y' = f(x,y); y(x0) = y[0], at x = x0 + h, where h is the step size and f_history[ ] is the array containing the values of the function f(x,y) evaluated at the starting values f(x0 - i*h,y(x0 - i*h)) for i = 1, …, 9. The Adams-Moulton method terminates either when successive estimates are within tolerance of each other or when the number of iterations exceeds iterations. Upon return, the y[1] contains the estimate of y(x0 + h), and the function itself returns the number of iterations used in the Adams-Mouton procedure.

• void Adams_10_Build_History(double (*f)(double,double), double f_history[ ], double y[ ], double x, double h)

This function builds the f_history[ ] array using the historical values y[i] = y(x + i*h) for
i = 0, …, 8. The ith element of the f_history[ ] array is then
f_history[i] = f( x-(9-i)*h, y(x-(9-i)*h) ), i = 0, …, 8.