abm3: Adams-Bashford-Moulton

abm3pcR Documentation

Adams-Bashford-Moulton

Description

Third-order Adams-Bashford-Moulton predictor-corrector method.

Usage

abm3pc(f, a, b, y0, n = 50, ...)

Arguments

f

function in the differential equation y' = f(x, y).

a, b

endpoints of the interval.

y0

starting values at point a.

n

the number of steps from a to b.

...

additional parameters to be passed to the function.

Details

Combined Adams-Bashford and Adams-Moulton (or: multi-step) method of third order with corrections according to the predictor-corrector approach.

Value

List with components x for grid points between a and b and y a vector y the same length as x; additionally an error estimation est.error that should be looked at with caution.

Note

This function serves demonstration purposes only.

References

Fausett, L. V. (2007). Applied Numerical Analysis Using Matlab. Second edition, Prentice Hall.

See Also

rk4, ode23

Examples

##  Attempt on a non-stiff equation
#   y' = y^2 - y^3, y(0) = d, 0 <= t <= 2/d, d = 0.01
f <- function(t, y) y^2 - y^3
d <- 1/250
abm1 <- abm3pc(f, 0, 2/d, d, n = 1/d)
abm2 <- abm3pc(f, 0, 2/d, d, n = 2/d)
## Not run: 
plot(abm1$x, abm1$y, type = "l", col = "blue")
lines(abm2$x, abm2$y, type = "l", col = "red")
grid()
## End(Not run)

pracma documentation built on March 19, 2024, 3:05 a.m.