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