source("http://macosa.dima.unige.it/r.R") # If I have not already loaded the library ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- S 18 Animations
While clock() and clock2(12,25,40) display the current time or hour that is written, Hour(), Minute() and Second() contain numerical information about the current time. Sec() provides the number of seconds since the start of the program; wait(x) does spend x seconds (useful commands for animations). | |
These commands can be used to create animations. If I want, I can store them in file that I can load with source command. For an example run the line: source("http://macosa.dima.unige.it/R/pythag.txt") or: source("http://macosa.dima.unige.it/R/pitag.txt") ( use: http://macosa.dima.unige.it/R/pitag.txt in the browser if you want see the file ) For another example see here |
BF=4; HF=4 PLANE(-3,3, -3,3) q=1; POINT(q,0, "red"); line2p(-1,-2, -1,2, "red") parabola <- function(x,y) y^2-4*q*x CURVE(parabola, "black") fig <- recordPlot() # the superior part of the parabola f = function(x) sqrt(4*q*x) for(x in (22:0)/10) {wait(0.3);replayPlot(fig) POINT(q,0, "red"); line2p(-1,-2, -1,2, "red") CURVE(parabola, "black") y = f(x); POINT(x,y, "brown") polyL( c(-1,x,1), c(y,y,0), "brown")} # a moment of the animation -> |