[R] Defining a variable outside of optim or differential equation solver.

Tjun Kiat Teo teotjunk at gmail.com
Wed Jul 18 03:59:36 CEST 2012


This is applicable to either using optim  or the differential equation
solver or any similar solver

Suppose I want to use the differential equation solver and this is my code

d<-y[2]

vdpol<-function(t,y)
{
list(c(1,
       d,
       3,
       4
      )
}


stiff<-ode(y=rep(0,4),times=c(0,1),func=dvdpol,parms=1)


The thing is I want d to be composed of one of state variables in the
differential function vdopl. Can it be done ?

tjun kiat



More information about the R-help mailing list