C1<-runif(1)
C2<-runif(1)
as<-seq(from=-1,to=1,length=11)
xs<-seq(from=-10,to=10,length=101)
ys<-ys1<-ys2<-matrix(0,length(as),length(xs))
for(i in 1:length(ys[,1])){
a<-as[i]
absa<-abs(a)
if(a<0){
ys[i,]<-C1*sinh(xs*sqrt(absa))+C2*cosh(xs*sqrt(absa))
dx<-deriv(~C1*sinh(xs*sqrt(absa))+C2*cosh(xs*sqrt(absa)),"xs")
ys1[i,]<-eval(dx)
}else if(a>0){
ys[i,]<-C1*sin(xs*sqrt(absa))+C2*cos(xs*sqrt(absa))
dx<-deriv(~C1*sin(xs*sqrt(absa))+C2*cos(xs*sqrt(absa)),"xs")
ys1[i,]<-eval(dx)
}else{
ys[i,]<-C1*xs+C2
dx<-deriv(~C1*xs+C2,"xs")
ys1[i,]<-eval(dx)
}
ys2[i,]<-(-a)*ys[i,]
}
matplot(t(ys),type="l",ylim=range(ys[11,])*5)
library(rgl)
plot3d(xs,ys[1,],ys1[1,])
xys<-cbind(xs,ys[8,],ys1[8,],ys2[8,])
plot(as.data.frame(xys))
matplot(xys[,2:4],type="l")
xys<-cbind(xs,ys[3,],ys1[3,],ys2[3,])
plot(as.data.frame(xys))
matplot(xys[,2:4],type="l")