Approximate method for nonlinear differential and integrodifferential equations