Mercurial > op > rk_sakamoti
comparison rk_Lorenz.R @ 5:0ca8347e4c47
add rk_Lorenz.R and rksub.f90
author | "uncorrelated zombie" <uncorrelated@yahoo.co.jp> |
---|---|
date | Tue, 23 Jul 2024 03:31:21 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:8026ceb4de7a | 5:0ca8347e4c47 |
---|---|
1 dll <- paste("rksub", .Platform$dynlib.ext, sep="") | |
2 dyn.load(dll) | |
3 | |
4 max_i <- as.integer(5000) | |
5 | |
6 r <- .Fortran("rk_sakamoti", | |
7 as.double(c(0.5, 0.5, 0.5)), | |
8 max_i, | |
9 matrix(0, max_i, 4)) | |
10 dyn.unload(dll) | |
11 | |
12 m <- r[[3]] | |
13 colnames(m) <- c("t", "x", "y", "z") | |
14 | |
15 png(filename = "Lorenz system.png", | |
16 width = 800, height = 600, bg="white", type="cairo") | |
17 library(scatterplot3d) | |
18 scatterplot3d(m[,2], m[,3], m[,4], | |
19 highlight.3d = FALSE, | |
20 col.axis = "blue", col.grid = "lightblue", | |
21 type = "l", color = "purple", lwd = 2, | |
22 main = "Lorenz system", | |
23 xlab = colnames(m)[2], | |
24 ylab = colnames(m)[3], | |
25 zlab = colnames(m)[4], | |
26 cex.main = 3, | |
27 cex.lab = 2) | |
28 dev.off() | |
29 |