view rk_Lorenz.R @ 6:d90925ba642e default tip

add a patch file
author "uncorrelated zombie" <uncorrelated@yahoo.co.jp>
date Tue, 23 Jul 2024 02:36:26 +0900
parents 0ca8347e4c47
children
line wrap: on
line source

dll <- paste("rksub", .Platform$dynlib.ext, sep="")
dyn.load(dll)

max_i <- as.integer(5000)

r <- .Fortran("rk_sakamoti",
	as.double(c(0.5, 0.5, 0.5)), 
	max_i,
        matrix(0, max_i, 4))
dyn.unload(dll)

m <- r[[3]]
colnames(m) <- c("t", "x", "y", "z")

png(filename = "Lorenz system.png", 
    width = 800, height = 600, bg="white", type="cairo")
library(scatterplot3d)
scatterplot3d(m[,2], m[,3], m[,4], 
    highlight.3d = FALSE, 
    col.axis = "blue", col.grid = "lightblue", 
    type = "l", color = "purple", lwd = 2,
    main = "Lorenz system", 
    xlab = colnames(m)[2],
    ylab = colnames(m)[3],
    zlab = colnames(m)[4],
    cex.main = 3,
    cex.lab = 2)
dev.off()