f2 <- function(x,y,parms) {
dy <- y[2]
dy2 <- -1/x*y[2]-(1-1/(4*x^2))*y[1] + sqrt(x)*cos(x)
list(c(dy,dy2))
}
x <- seq(1,6,0.1)
sol <- bvptwp(yini=c(y=1,dy=NA),yend=c(-0.5,NA),x=x,func=f2,guess=1)
plot(sol,which="y")
diagnostics(sol)Run the code above in your browser using DataLab