R/StepEuler.R

Defines functions StepEuler

Documented in StepEuler

# function

StepEuler <- function(RHSfun,dt=0.01)
{
  return(
         function(x0, t0, deltat,...)
         {
           x = x0
           t = t0
           termt = t0+deltat
           repeat {
             x = x+RHSfun(x, t, ...)*dt
             t = t+dt
             if (t > termt)
               return(x)
           }
         }
         )		
}	



# eof

Try the smfsb package in your browser

Any scripts or data that you put into this service are public.

smfsb documentation built on Jan. 13, 2024, 3:02 a.m.